Schemas / Spatial / scene

rig.spatial.anchor

v0.31.0 · draft 3 fields 1 required

Fields

FieldTypeMeaning
point enumtop-left · top-center · top-right · middle-left · center · middle-right · bottom-left · bottom-center · bottom-right required One of the nine 3×3 face cells (see below)
height enummin · center · max optional Optional Z slice of the cuboid: min / center / max. Absent = min.
offset vec2 optional Optional. Nudge after the named cell, local XY. Absent = (0, 0).

Which cell of an entity's local bounds is the local origin. Format when present. Axes stay +X +Y +Z - the host offsets to the named cell; it does not invert signs.

Not a locator you place - that is rig.spatial.vertex. Not rig.font.anchor (named glyph point).

XY (point):

top-left top-center top-right
middle-left center middle-right
bottom-left bottom-center bottom-right

Together with height, that is a 3×3×3 cuboid cell (27 corners / edge midpoints / centre) without twenty-seven string ids.

Absent component: do not remap. Local (0,0) stays where the entity's size schema already puts it - page trim defaults to top-left; rig.geometry.rectangle keeps its authored x,y corner; centre-authored primitives (ellipse, regular_polygon, star, arc, ring) keep their authored centerX/centerY.

When present: point (and optional height) names which cell of the local axis-aligned bounds coincides with local (0,0,0) (and with rig.spatial.transform position when that is present). Then add offset. The host offsets from authored bounds to honour it - geometry field layouts do not change. Interior directions follow the host axes: an origin at top-left on a Y-up bed means the interior is +X and −Y.

Compose onto any entity that has local bounds. On a page, it is also where page-local (0,0) sits for children. height matters when the host has a Z extent (machine envelope, mesh AABB, 3D zone); planar pages may omit it. Z free-pivot (offsetZ / vec3) is not in this draft.

Do not put this enum or offset on transform - pose stays TRS only. Do not re-declare the field on rig.layout.page or geometry schemas. Do not encode origin as axis invert (signX / signY / signZ). Do not treat point and offset as alternatives - snap to the cell, then nudge.

Bounds come from the entity's size (page trim, rectangle extent, ellipse radii, host AABB for meshes). Without bounds, omit this component.

JSON Schema

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

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://rig.works/schemas/rig.spatial.anchor.schema.json",
  "title": "rig.spatial.anchor",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "point": {
      "type": "string",
      "enum": [
        "top-left",
        "top-center",
        "top-right",
        "middle-left",
        "center",
        "middle-right",
        "bottom-left",
        "bottom-center",
        "bottom-right"
      ]
    },
    "height": {
      "type": "string",
      "enum": [
        "min",
        "center",
        "max"
      ]
    },
    "offset": {
      "$ref": "./_defs.schema.json#/$defs/vec2"
    }
  },
  "required": [
    "point"
  ]
}

Seen in

page-anchor.json