Skip to main content

Physics Bodies

There are different kinds of physics bodies you can create in 3dverse: static body, rigid body, and kinematic rigid body.

Note that these bodies are all rigid bodies in the classical sense, in that they stay solid and do not deform during collision.

The main difference between the static body and rigid body is that the former is static (expected not to move) during simulation whereas the latter is dynamic (expected to move).

Each of these physics bodies require you to attach some kind of geometry to them which will define their geometry in the physics engine.

Static Body

A static body will not be affected by forces such as gravity.

To make your entity a static body it needs the following components:

  • Physics Material
  • One geometry component from this list:
    Box Geometry
    ,
    Capsule Geometry
    ,
    Sphere Geometry
    ,
    Cylinder Geometry
    ,
    Plane Geometry
    or
    Collision Geometry Reference

Rigid Body

A rigid body will collide against all other physics bodies.

To make your entity a rigid body it needs the following components:

  • Physics Material
  • one geometry component from this list:
    Box Geometry
    ,
    Capsule Geometry
    ,
    Sphere Geometry
    ,
    Cylinder Geometry
    or
    Collision Geometry Reference
    (but the collision geometry must be convex, NOT triangular)
  • Rigid Body
    (with isKinematic = false)

Kinematic Rigid Body

If you move a kinematic rigid body it will collide against rigid bodies, but not against static or kinematic rigid bodies (i.e. if you move it into a static body or another kinematic rigid body, it will go through, but if you move it into a rigid body, this will move your rigid body).

To make your entity a kinematic rigid body it needs the following components:

  • Physics Material
  • one geometry component from this list:
    Box Geometry
    ,
    Capsule Geometry
    ,
    Sphere Geometry
    ,
    Cylinder Geometry
    ,
    Plane Geometry
    or
    Collision Geometry Reference
  • Rigid Body
    (with isKinematic = true)

Character Controller

See Character Controller.

Trigger

A trigger physics body is a physics body with isTrigger set to true in its

Physics Material
component.

Trigger bodies are used for triggering events, and whatever collision that may occur with them is detected, but not resolved by the physics engine. A trigger event allows a developer to react to two entities colliding and apply some logic to that. See Physics-Based Events for more info on trigger events.

Best Practices

The recommendations of “when to use” each physics body are best practices.

For example, a static body is recommended for a non-moving entity. Although you probably shouldn’t, don’t be surprised if you can actually move a static body during simulation by changing its transform. However, collision detection may not work as well and you may get unexpected results because of the way the physics engine is optimized.

So it’s important to configure your physics bodies correctly and follow the recommendations outlined in this doc.