Examples

Physics Scene Setup

How to set up static, dynamic, kinematic, box, capsule, and mesh collider scenes.

Reference Scenes

Use these sample scenes as current ground truth:

Nevo-base/game/levels/physics.json
Nevo-base/game/levels/outside.json

physics.json is compact and useful for testing dynamic objects. outside.json shows larger imported world geometry, mesh colliders, capsule colliders, and post-processing.

Dynamic Mesh Body

From the physics.json monkey setup:

{
  "type": "Rigidbody",
  "data": {
    "type": "Dynamic",
    "mass": 1.0,
    "linearVelocity": [0.0, 0.0, 0.0],
    "drag": 0.0,
    "useGravity": true,
    "freezeRotation": false
  }
},
{
  "type": "MeshCollider",
  "data": {
    "convex": true,
    "friction": 0.5,
    "restitution": 0.0,
    "isTrigger": false
  }
}

For dynamic mesh bodies, use convex: true unless you know the backend supports the shape you need.

Static World Mesh

From outside.json road geometry:

{
  "type": "Rigidbody",
  "data": {
    "type": "Static",
    "mass": 1.0,
    "linearVelocity": [0.0, 0.0, 0.0],
    "drag": 0.0,
    "useGravity": true
  }
},
{
  "type": "MeshCollider",
  "data": {
    "convex": true,
    "friction": 0.5,
    "restitution": 0.0,
    "isTrigger": false
  }
}

Static bodies do not need mass or gravity to move, but current scene output may still include those fields.

Kinematic Floor with BoxCollider

From physics.json floor pattern:

{
  "type": "Rigidbody",
  "data": {
    "type": "Kinematic",
    "mass": 0.0,
    "useGravity": false,
    "freezeRotation": true
  }
},
{
  "type": "BoxCollider",
  "data": {
    "center": [0.0, 0.0, 0.0],
    "size": [8.35, 0.1, 12.0],
    "friction": 0.8,
    "restitution": 0.0,
    "isTrigger": false
  }
}

Use box colliders for simple floors, platforms, and blocking volumes.

Capsule Body

From the outside.json tire-like capsule setup:

{
  "type": "Rigidbody",
  "data": {
    "type": "Dynamic",
    "mass": 1.0,
    "linearVelocity": [0.0, 0.0, 0.0],
    "useGravity": true
  }
},
{
  "type": "CapsuleCollider",
  "data": {
    "center": [0.0, 0.0, 0.0],
    "radius": 0.34,
    "height": 0.68,
    "friction": 0.5,
    "restitution": 0.0,
    "isTrigger": false
  }
}

Capsules are the preferred primitive for upright characters.

Collider Material Fields

FieldMeaning
frictionSurface friction, minimum 0.
restitutionBounce, clamped 0..1.
isTriggerQuery/overlap style body rather than a solid collider.

Debugging Physics Scenes

  • Confirm the entity has Transform, Rigidbody, and exactly one intended collider.
  • Confirm dynamic bodies have nonzero mass.
  • Confirm primitive collider dimensions are not zero.
  • Confirm imported mesh paths resolve and are rendered.
  • Use GetPhysicsSystem()->HasBody(entity) when debugging game-created entities.
  • For controller-style logic, use public physics APIs rather than writing dynamic Transform every frame.