Motion SDK

Physics

Rigid bodies that fall, tumble and collide, joints that link them, cloth that drapes, and soft pads that squash on contact.

"body": {} on a node makes it a rigid body. The world is simulated once when the scene loads, then scrubs like keyframes, so it stays deterministic.

A heavy ball thrown through a wall that shatters into chunks.
{
  "camera": { "position": [0, 3, 10], "target": [0, 1, 0], "fov": 40 },
  "lighting": { "rig": "studio_soft" },
  "environment": {
    "background": {
      "radial_gradient": { "inner": "#1b2233", "outer": "#07090f" }
    }
  },
  "physics": { "gravity": [0, -9.81, 0], "ground": 0 },
  "materials": { "floor": { "preset": "matte_clay", "color": "#2a2f3a" } },
  "nodes": {
    "floor": {
      "mesh": {
        "geometry": { "plane": { "size": [30, 30] } },
        "material": "floor"
      },
      "transform": { "rotation": [-90, 0, 0] }
    },
    "wall": {
      "transform": { "position": [0, 1, 0] },
      "mesh": {
        "geometry": { "box": { "size": [3, 2, 0.6] } },
        "material": "preset:ceramic"
      },
      "shatter": {
        "start": 0.8,
        "pieces": [6, 4, 1],
        "speed": 4,
        "from": [0, 0, 0.5]
      }
    },
    "ball": {
      "transform": { "position": [0, 1, 6] },
      "mesh": {
        "geometry": { "sphere": { "radius": 0.4 } },
        "material": "preset:chrome"
      },
      "body": { "mass": 20, "velocity": [0, 1, -10] }
    }
  },
  "timeline": { "duration": 3, "loop": "once" }
}
A heavy ball thrown through a wall that shatters into chunks. apps/docs/examples/physics.json · render it with motion-sdk render apps/docs/examples/physics.json -t 1 -o physics.png

Bodies

  • The collision shape comes from the mesh: spheres stay spheres, everything else is its box. Or set shape to a box, sphere or capsule.
  • type: dynamic (simulated), static (walls and ramps), or kinematic (keyframed pushers).
  • mass, bounce (0 to 1) and friction.
  • start: until then the body follows its keyframes, then it's released with the speed it had, plus velocity and spin (degrees per second). Throw something by keyframing it, then release it.
  • Put bodies at the top level or under groups that don't move.

World

physics: {"gravity": [0, -9.81, 0], "ground": 0} sets gravity and an endless floor. "ground": null removes the floor.

Shatter

"shatter": {"start": 2.5, "pieces": [6, 5, 1], "speed": 4, "from": [0, 0, -0.5]} on a box breaks it into chunk bodies at start, bursting away from from.

Joints

"joint": {"parent": "upper", "kind": "hinge", "limits": [0, 90]} on a body links it to another body. The chain is simulated with the rest of the physics, so it scrubs like keyframes.

  • kind: hinge (one axis), universal (two), ball (a socket), or fixed (welded).
  • axis and, for universal, axis2.
  • limits are [min, max] degrees. On a ball, max is the swing cone.
  • stiffness and target drive a motor. track_keyframes: true follows the node's keyed pose and still yields on contact.
  • couple copies another joint's angle, like a fingertip following the middle knuckle.

Both nodes need a body. Parent links must not form a cycle.

Cloth

"cloth": {"size": [2, 3], "preset": "flag", "pins": [{"edge": "top_edge", "node": "pole"}]} is a sheet in the node's local XY plane. Rotate [-90, 0, 0] to lay it flat. Pins hold an edge, the corners, or a UV point, and can ride on another node.

wind blows on the sheet. self_collide stops it passing through itself.

Soft tissue

"soft": {"preset": "fingertip"} is a flesh pad on the node, usually a finger or palm. It squashes against bodies and the ground, then returns. Presets are fingertip, palm, jelly and rubber.

Native rendering and export (the CLI) include physics. The browser authoring and WebGL2 bundles leave it out for now, so they stay under the size caps; a follow-up will load it as an opt-in bundle, like WebXR.

API Reference

Physics

World settings for every body.

PropertyTypeDefaultDescription
gravity[x, y, z][0,-9.81,0]Acceleration in m/s² (default Earth gravity, down).
groundnumber0Height of an endless solid floor; null for none.
ground_bouncenumber0.2Bounce and friction of the floor.
ground_frictionnumber0.6Friction of the floor.

Body

Makes a node a rigid body. Its collision shape comes from its mesh (a sphere for spheres and icosahedra, else the box around it) unless shape says otherwise. Until start it follows its keyframes; then it is released with the speed it had (plus velocity and spin). Put bodies at the top level or under unmoving groups.

PropertyTypeDefaultDescription
bouncenumber0.30 = dead stop, 1 = bounces back to full height.
buoyancynumber—How it floats in a flood: 1 rides half under the surface (wood, a crate), 2 bobs high (a beach ball), below 0.5 sinks (stone), 0 sinks like a rock (water still drags it).
frictionnumber0.6Surface friction, 0 (ice) to 1 (rubber).
massnumber1Kilograms (only ratios between bodies matter).
shapeBodyShape—An explicit collision shape. Defaults to the mesh's sphere or bounding box.
spin[x, y, z]—Extra launch spin at release, degrees/s about x, y, z.
startnumber—Release time, seconds (dynamic bodies).
typeBodyType—How the body moves: simulated, or fixed in place for others to hit.
velocity[x, y, z]—Extra launch velocity at release, m/s.

BodyType

How a body moves.

ValueDescription
"dynamic"Falls, tumbles and collides.
"static"Never moves; others collide with it (walls, ramps).
"kinematic"Moves only by its keyframes and pushes dynamic bodies out of the way (a wrecking ball, a bulldozer blade).

BodyShape

An explicit collision shape, in the node's local units (before scale).

{"box": { … }}A box collider.

PropertyTypeDefaultDescription
size*[x, y, z]requiredFull size [x, y, z] in the node's local units.

{"sphere": { … }}A sphere collider.

PropertyTypeDefaultDescription
radius*numberrequiredRadius in the node's local units.

{"capsule": { … }}Capsule along the local Y axis: cylinder of length capped by hemispheres of radius.

PropertyTypeDefaultDescription
length*numberrequiredLength of the straight middle part, along the local Y axis, in the node's local units.
radius*numberrequiredRadius of the cylindrical body and the hemispherical caps, in the node's local units.

Shatter

Break a box into a grid of chunks that burst apart at start and fall as rigid bodies (a wall smashed, a crate blown open). Until then the chunks sit together and look like the whole box. Needs a box mesh.

PropertyTypeDefaultDescription
from[x, y, z]—Where the blow lands, in the node's local space (default: its centre, so it bursts evenly). Chunks fly away from it.
piecesinteger[][4,3,2]Chunks along x, y and z (1 to 12 each).
speednumber4Burst speed in m/s, away from from.
spinnumber240Random tumble, degrees/s.
start*numberrequiredSeconds into the timeline when it breaks.

Joint

Articulated rigid-body joint constraint (XPBD) connecting this node's body to parent's body. Supports angular limits, compliant PD motors, half-physics keyframe tracking, and anatomical tendon coupling.

PropertyTypeDefaultDescription
anchor[x, y, z]—Local-space anchor point on this node.
axis[x, y, z]—Primary rotation axis in this node's local space (default [1, 0, 0]).
axis2[x, y, z]—Secondary rotation axis for universal joints (default [0, 0, 1]).
collide_connectedboolean—Allow collision between this body and parent (default false).
coupleJointCouple—Anatomical tendon coupling to another joint's flexion angle.
dampingnumber0.15Angular velocity damping across the joint (0..=10, default 0.15).
kindJointKind—Constraint topology: hinge (1-DOF), universal (2-DOF), ball (3-DOF), or fixed.
limits[x, y]—Primary angular limits [min_deg, max_deg] (for ball, max_deg is the swing cone).
limits2[x, y]—Secondary angular limits [min_deg, max_deg] for universal joints.
parent*stringrequiredNode id of the parent rigid body this joint attaches to.
parent_anchor[x, y, z]—Local-space anchor point on parent. When omitted, inferred from the initial world poses at t = 0 so the joint starts aligned.
stiffnessnumber—Compliant angular PD motor stiffness (0 = passive/free, higher = stiffer tracking).
targetnumber—Fixed motor target angle in degrees along axis.
track_keyframesboolean—Half-physics mode: when true, the PD motor tracks this node's keyframed orientation relative to parent while still deflecting on contact.

JointKind

Type of articulated constraint connecting two rigid bodies.

ValueDescription
"hinge"1-DOF revolute hinge about axis (e.g. finger PIP/DIP knuckles).
"universal"2-DOF universal joint about axis and axis2 (e.g. finger MCP knuckle).
"ball"3-DOF ball-and-socket joint with optional swing cone limits (e.g. thumb CMC).
"fixed"0-DOF rigid attachment (welds two bodies together).

JointCouple

Tendon coupling: drives this joint's target angle proportionally to another joint's current flexion angle (e.g. human finger DIP ≈ 0.67 × PIP).

PropertyTypeDefaultDescription
from*stringrequiredNode id of the driving joint.
rationumber0.67Multiplier applied to from's primary angle (default 0.67).

Cloth

Simulated cloth sheet lying in the node's local XY plane (like plane, rotate [-90, 0, 0] to lay flat for a drape or tablecloth). Simulated once on load with rigid bodies using deterministic substepped XPBD, so every frame scrubs like keyframes.

PropertyTypeDefaultDescription
bendnumber—Bending compliance (0 = stiff cardboard, higher = softer drape; overrides preset).
dampingnumber—Velocity damping fraction (0..=1; overrides preset).
dragnumber—Aerodynamic drag coefficient (overrides preset).
massnumber—Total cloth mass in kg (overrides preset).
materialstring—Material reference for rendering the cloth surface.
pinsClothPin[]—Pinned edges, corners, UV points, or attachments to animated nodes.
presetClothPreset—Material preset controlling default stiffness, mass, damping and drag.
segmentsinteger[][20,20]Grid subdivisions [cols, rows] (2..=64 each). More is finer and slower.
self_collideboolean—Enable deterministic spatial-hash self-collision (off by default).
size[x, y][2,2]Width (local x) and height (local y) of the sheet, world units.
startnumber—Release time in seconds (stays in rest pose until start).
stretchnumber—Structural (warp) stretch compliance (0 = inextensible; overrides preset).
substepsinteger6XPBD substeps per physics tick (1..=20, default 6).
thicknessnumber0.02Collision thickness / offset in world units.
weft_stretchnumber—Horizontal (weft) stretch compliance for anisotropic weaves (defaults to stretch).
windClothWind—Optional wind blowing on the cloth.

ClothPreset

Material preset for a [Cloth] node: tuned defaults for stretch, bending, mass, damping and wind drag.

ValueDescription
"cotton"
"silk"
"denim"
"flag"
"curtain"

ClothPin

Pins vertices of a [Cloth] sheet in place, or attaches them to another node so the cloth moves with an animated/kinematic carrier (e.g. a flagpole, curtain rod, or character shoulder).

PropertyTypeDefaultDescription
edgeClothPinEdge—Preset edge or corner selection.
nodestring—Optional node id whose world transform carries the pinned vertices.
uv[x, y]—Pin the vertex nearest to normalized [u, v] (0..=1 across width and height, where v = 0 is the top edge and v = 1 is the bottom).

ClothPinEdge

Edge or corner shorthand for pinning vertices of a [Cloth] sheet.

ValueDescription
"top_edge"
"bottom_edge"
"left_edge"
"right_edge"
"top_corners"
"all_corners"

ClothWind

Wind field acting on a [Cloth] sheet via aerodynamic drag and lift.

PropertyTypeDefaultDescription
direction[x, y, z][1,0,0]World-space wind direction (normalized by the solver).
strengthnumber0Wind speed in m/s.
turbulencenumber0.3Deterministic gust/turbulence amplitude (0 = steady wind).

SoftTissue

PhysHand-style layered skin–flesh–bone XPBD soft tissue pad attached to a node (typically a phalanx rigid body or kinematic bone). Deforms smoothly on contact with other rigid bodies and the ground while preserving local pad volume, baked deterministically for zero-alloc scrubbing.

PropertyTypeDefaultDescription
bulgenumber—Lateral volume-preservation bulge factor (0..=1).
compliancenumber—XPBD bone-anchor compliance override (lower = stiffer).
dampingnumber—Velocity damping (0..=1).
dorsal_stiffboolean—Keep the dorsal (+Z) hemisphere stiff like a fingernail backing.
materialstring—Optional material override (defaults to the node's mesh material).
presetSoftPreset—Tuned material preset (fingertip, palm, jelly, rubber).
segmentsinteger14Surface subdivision rings (8..=32, default 14).
substepsinteger4XPBD substeps per physics tick (1..=16, default 4).
thicknessnumber—Maximum soft flesh compression depth in world units.

SoftPreset

Material preset for a [SoftTissue] pad (PhysHand-style skin-flesh-bone XPBD).

ValueDescription
"fingertip"Compliant palmar fingertip pad with stiff dorsal/nail backing.
"palm"Thicker, firmer palm cushion.
"jelly"Very soft, bouncy isotropic gel.
"rubber"Firm elastomer gripper pad.