Schemas / Spatial / scene

rig.spatial.transform

v0.31.0 · draft 4 fields 0 required

Fields

FieldTypeMeaning
position vec3 optional Optional. Local translation; absent = (0, 0, 0)
rotation quat optional Optional. Local orientation (authoritative); absent = identity (0, 0, 0, 1). Field order: x, y, z, w
scale vec3 optional Optional. Local scale; absent = (1, 1, 1)
shear vec3 optional Optional. Local shear factors (xy, xz, yz); absent = (0, 0, 0)

Local pose. Format when present.

All fields optional; an absent field means identity, so hosts may emit only what differs. Serialize at most these four fields. Do not serialize derived values a host may keep beside them (editor Euler angles, world matrix cache) - rebuild those from local pose + parent.

Composition order is translate * rotate * shear * scale, with shear the unit upper-triangular factor (xy shears x by y, xz shears x by z, yz shears y by z). This makes any 2D affine land exactly in one transform (shear[0] is the 2D skew; a rect stays a rect component under it). Hosts that cannot render shear skip it like any unknown field - report it, don't guess.

Which point of local bounds position attaches to is rig.spatial.anchor - compose it; do not add pivot fields here.

Quat + Euler (hosts)

  • rotation (quat) is the portable / composition source of truth - avoids gimbal lock for accumulated pose.
  • Hosts may keep an editor Euler cache (radians) for property panels. That cache is not portable Rig data - do not serialize it.
  • When the editor writes Euler, update rotation from it.
  • When code / gizmos write rotation, refresh the Euler cache for display (eulerAngles).
  • Present / hierarchy must build the local matrix from rotation, not from Euler.

2D hosts may use z = 0 and identity quat.

JSON Schema

Resolves at https://rig.works/schemas/rig.spatial.transform.schema.jsonraw file.

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://rig.works/schemas/rig.spatial.transform.schema.json",
  "title": "rig.spatial.transform",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "position": {
      "$ref": "./_defs.schema.json#/$defs/vec3"
    },
    "rotation": {
      "$ref": "./_defs.schema.json#/$defs/quat"
    },
    "scale": {
      "$ref": "./_defs.schema.json#/$defs/vec3"
    },
    "shear": {
      "$ref": "./_defs.schema.json#/$defs/vec3"
    }
  }
}

Seen in

bim-bcf.json · bim-model.json · cad-boolean.json · cad-dimension.json · cad-reference.json · lfo-binding.json · lights.json · minimal-scene.json · page-anchor.json · path3d-spline3d.json · place-address.json · story-frames.json