Motion SDK

Paths and Signals

Curves for nodes to follow, traffic that queues at lights, crowds, and cycling signals.

paths holds curves. Nodes follow them, and path instances ride them. signals are cycling states, like traffic lights, that stop followers and show or hide nodes.

Six cars on a rounded loop that queue at a red light, a crowd on a bezier, and lamps driven by the signal.
{
  "camera": { "position": [0, 22, 20], "target": [0, 0, 0], "fov": 40 },
  "lighting": { "rig": "golden_hour" },
  "environment": { "background": { "solid": "#20262e" } },
  "materials": {
    "road": { "color": "#2b2f36" },
    "car": { "preset": "glossy_plastic" },
    "red": { "preset": "neon", "color": "#ff2a2a" },
    "green": { "preset": "neon", "color": "#2aff6a" }
  },
  "paths": {
    "loop": {
      "polyline": {
        "points": [[-10, 0, -6], [10, 0, -6], [10, 0, 6], [-10, 0, 6]],
        "closed": true,
        "corner_radius": 3
      }
    },
    "walk": {
      "bezier": { "points": [[-12, 0, 9], [-4, 0, 12], [4, 0, 6], [12, 0, 9]] }
    }
  },
  "signals": {
    "light": {
      "phases": [
        { "state": "go", "duration": 3 },
        { "state": "caution", "duration": 1 },
        { "state": "stop", "duration": 3 }
      ]
    }
  },
  "nodes": {
    "road": {
      "mesh": {
        "geometry": { "plane": { "size": [30, 24] } },
        "material": "road"
      },
      "transform": { "rotation": [-90, 0, 0] }
    },
    "cars": {
      "transform": { "position": [0, 0.4, 0] },
      "mesh": {
        "geometry": { "box": { "size": [1.6, 0.8, 3] } },
        "material": "car",
        "instances": {
          "path": {
            "path": "loop",
            "count": 6,
            "speed": 6,
            "stops": [{ "at": 10, "signal": "light" }],
            "colors": ["#f2c230", "#d23a33", "#3d85c6"]
          }
        }
      }
    },
    "walkers": {
      "transform": { "position": [0, 0.5, 0] },
      "mesh": {
        "geometry": { "capsule": { "radius": 0.2, "length": 0.6 } },
        "material": "preset:matte_clay",
        "instances": {
          "path": { "path": "walk", "count": 10, "speed": 1.4, "spread": 0.8 }
        }
      }
    },
    "red": {
      "transform": { "position": [10, 2, -8] },
      "mesh": {
        "geometry": { "sphere": { "radius": 0.35 } },
        "material": "red"
      },
      "show_when": { "signal": "light", "states": ["stop", "caution"] }
    },
    "green": {
      "transform": { "position": [10, 1.2, -8] },
      "mesh": {
        "geometry": { "sphere": { "radius": 0.35 } },
        "material": "green"
      },
      "show_when": { "signal": "light", "states": ["go"] }
    }
  },
  "timeline": { "duration": 7, "loop": "loop" }
}
Six cars on a rounded loop that queue at a red light, a crowd on a bezier, and lamps driven by the signal. apps/docs/examples/paths.json · render it with motion-sdk render apps/docs/examples/paths.json -t 1 -o paths.png

Paths

  • polyline: points, closed, and corner_radius to round each corner.
  • bezier: [p0, c0, c1, p1, ...] control points.

Follow

follow on a node moves it along a path.

  • speed in units per second, or duration with an easing.
  • offset or phase to start part-way along. start waits before moving.
  • lateral shifts sideways, for lanes (+ is right).
  • orient faces along the path. Nodes face -z.
  • end: wrap around a closed path, or hold at the end.
  • stops, brake and gap: stop lines that wait for a signal, how long braking takes, and queue spacing. Followers on the same path queue behind each other at red lights.

Crowds and Traffic

"instances": {"path": {...}} puts count copies on one path in a single draw call, with speed, speed_jitter, spread, lateral, per-copy colors and the same stops.

Signals

A signal cycles through go, caution and stop phases, each with a duration, starting offset seconds in. show_when: {"signal": "light", "states": ["stop"]} shows a node only in those states, like a red lamp.

API Reference

Path

A path shape. Written as {"polyline": {...}} or {"bezier": {...}}.

{"polyline": { … }}Straight segments through points; corner_radius rounds corners so followers turn smoothly.

PropertyTypeDefaultDescription
closedbooleanfalseJoin the last point back to the first.
corner_radiusnumber0Round each corner with an arc of this radius.
points*[x, y, z][]requiredThe points, [x, y, z] each.

{"bezier": { … }}Cubic Bézier chain: [p0, c0, c1, p1, c2, c3, p2, ...] (3k+1 points; 3k when closed, the last segment returning to p0).

PropertyTypeDefaultDescription
closedbooleanfalseJoin the last point back to the first.
points*[x, y, z][]requiredControl points, [x, y, z] each.

Follow

Ride a path. The node sits at the path point, shifted lateral to the right of travel, plus its own position; with orient it turns to face along the path (models face -Z, like the camera).

PropertyTypeDefaultDescription
brakenumber1Seconds to brake to a stop and to pull away again.
durationnumber—Travel the whole path in this many seconds with easing, instead of at a speed (stops are ignored then).
easingEasing"linear"Timing curve for travel in duration mode.
endPathEnd"wrap"What happens at the end of the path: stop, loop or ping-pong.
gapnumber6Queue spacing behind followers already waiting at the same stop.
lateralnumber0Sideways shift, positive = right of the travel direction (lanes).
offsetnumber0Starting distance along the path.
orientbooleantrueFace along the path.
path*stringrequiredId of an entry in paths.
phasenumber0Starting point as a fraction of the path length (added to offset).
speednumber1World units per second (ignored when duration is set).
startnumber0Seconds before moving (the follower waits at its start point).
stopsStop[]—Stop lines (speed mode only).

PathEnd

What a follower does at the end of an open path.

ValueDescription
"wrap"Start over from the beginning (closed paths always wrap).
"hold"Stay at the end.

Stop

A stop line on a path, honored while its signal is not go.

PropertyTypeDefaultDescription
at*numberrequiredDistance along the path (world units).
signal*stringrequiredId of an entry in signals.

PathInstances

Copies spread along a path, each riding it (crowds, traffic). Copy k starts k * spacing behind the first (default: evenly around the path).

PropertyTypeDefaultDescription
brakenumber1Seconds to brake to a stop and to pull away again.
colorsColor[]—Per-copy colors, cycled.
count*integerrequiredNumber of copies.
gapnumber6Queue spacing behind copies already waiting at the same stop.
lateralnumber0Sideways shift of every copy.
offsetnumber0Starting distance along the path of the first copy.
orientbooleantrueFace along the path.
path*stringrequiredId of the path in paths.
spacingnumber—Distance between consecutive copies (default: path length / count).
speednumber1Speed in units per second.
speed_jitternumber0Random speed variation as a fraction (0.2 = +-20%), seeded per copy.
spreadnumber0Random sideways spread (+-), seeded per copy.
stopsStop[]—Stop lines where copies wait for a signal.

Signal

A cycling signal such as a traffic light. Followers stop for it at follow.stops; nodes can show or hide with it (show_when).

PropertyTypeDefaultDescription
offsetnumber0Seconds into the cycle at t = 0 (use to offset crossing directions).
phases*SignalPhase[]requiredThe cycle, repeated forever.

SignalPhase

One step of a signal cycle.

PropertyTypeDefaultDescription
duration*numberrequiredSeconds.
state*SignalStaterequiredThe signal's state during this step.

SignalState

What a signal currently shows.

ValueDescription
"go"Followers pass.
"caution"Followers that have not started braking stop (amber).
"stop"Followers stop at the line.

ShowWhen

Show a node only while a signal is in one of states (traffic light lamps).

PropertyTypeDefaultDescription
signal*stringrequiredId of the signal in signals.
states*SignalState[]requiredSignal states in which the node is visible.