Schemas / Simulation

rig.sim.rigidbody

v1.0.0 · stable maturity: stable 13 fields 0 required

Fields

FieldTypeMeaning
bodyType enumstatic · dynamic · kinematic optional Optional. static, dynamic, kinematic; absent = dynamic
velocity vec3 optional Optional. World-space linear velocity, units per second; absent = at rest
angularVelocityDegrees vec3 optional Optional. World-space angular velocity, degrees per second about X Y Z; absent = no spin
mass float optional Optional. Mass; must be greater than 0; absent = 1
inertia array<number>6 items optional Optional. ixx, iyy, izz, ixy, ixz, iyz about centerOfMass, body frame. Mass times scene length squared. Absent = computed from colliders
drag number0 – 1 optional Optional. 0-1, fraction of linear velocity lost per second; absent = 0
angularDrag number0 – 1 optional Optional. 0-1, fraction of angular velocity lost per second; absent = 0
gravity vec3 optional Optional. Per-body acceleration, units per second squared. When set, replaces ambient gravity and gravityScale is ignored
gravityScale float optional Optional. Multiplier on the host's ambient gravity; absent = 1
lockRotation bool optional Optional. No spin; forces stay linear; absent = false
canSleep bool optional Optional. May sleep when still; absent = true
continuous bool optional Optional. Continuous collision for fast bodies; absent = false
centerOfMass vec3 optional Optional. Local centre of mass. Absent = computed from colliders

Physics body. Format when present.

velocity and angularVelocityDegrees are the body when the document is loaded. An author writes the launch. A host that saves a running simulation writes the current values, and another host can continue from that snapshot. Position at that moment is rig.spatial.transform.

bodyType static does not integrate. kinematic moves from its transform and pushes dynamic bodies. dynamic integrates. A rig.sim.character on the same entity is the motor either way: do not also integrate this body.

drag is a fraction lost per second, not a physics-engine damping coefficient. Hosts convert. Sleeping, contact counts, and applied forces stay in the host.

Ambient gravity is rig.sim.world on the scene. This body's gravity replaces that vector. gravityScale multiplies it when gravity is absent. A metres scene that wants Earth sets world gravity to [0, -9.81, 0].

Contact shape, friction, and restitution are rig.sim.collider. Constraints are rig.sim.joint. Contact manifolds and the solver stay in the host.

JSON Schema

Resolves at https://rig.works/schemas/rig.sim.rigidbody.schema.json — raw file.

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://rig.works/schemas/rig.sim.rigidbody.schema.json",
  "title": "rig.sim.rigidbody",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "bodyType": {
      "type": "string",
      "enum": [
        "static",
        "dynamic",
        "kinematic"
      ]
    },
    "velocity": {
      "$ref": "./_defs.schema.json#/$defs/vec3"
    },
    "angularVelocityDegrees": {
      "$ref": "./_defs.schema.json#/$defs/vec3"
    },
    "mass": {
      "$ref": "./_defs.schema.json#/$defs/float"
    },
    "inertia": {
      "type": "array",
      "minItems": 6,
      "maxItems": 6,
      "items": {
        "type": "number"
      },
      "$comment": "ixx, iyy, izz, ixy, ixz, iyz about centerOfMass, body frame"
    },
    "drag": {
      "type": "number",
      "minimum": 0,
      "maximum": 1
    },
    "angularDrag": {
      "type": "number",
      "minimum": 0,
      "maximum": 1
    },
    "gravity": {
      "$ref": "./_defs.schema.json#/$defs/vec3"
    },
    "gravityScale": {
      "$ref": "./_defs.schema.json#/$defs/float"
    },
    "lockRotation": {
      "$ref": "./_defs.schema.json#/$defs/bool"
    },
    "canSleep": {
      "$ref": "./_defs.schema.json#/$defs/bool"
    },
    "continuous": {
      "$ref": "./_defs.schema.json#/$defs/bool"
    },
    "centerOfMass": {
      "$ref": "./_defs.schema.json#/$defs/vec3"
    }
  },
  "x-rig-maturity": "stable"
}

Seen in

play-scene.json · robot-lab.json · robot-lesson.json