Provides an actor with an interface to the Rapier physics simulation.

Allows you to create a rigid body to track the object's position, and attach colliders to it. An object may only have one rigid body as a time, but can have multiple colliders.

Note: Only kinematic rigid bodies listen for Worldcore movement events. Other types of rigid bodies (static, dynamic) should not have their positions changed after they are created. Static rigid bodies don't move, and the position of dynamic rigid bodies is controlled by the simulation.


# rigidBody

Returns the Rapier rigid body attached to this Wordcore object.


# createRigidBody(rigidBodyDesc)

Create a new rigid body for this object. Deletes any previous rigid body and its attached colliders. An object can only have one rigid body at a time. The position of the rigid body is taken from the position of the object at the moment that it's created. Takes as its argument a Rapier rigid body description (see the Rapier docs for more information.)

Supported types:

  • Static - Doesn't move
  • Dynamic - Position controlled by simulation
  • KinematicPositionBased - Position controlled by user
Name Type Description
rigidBodyDesc RigidBodyDesc

A Rapier rigid body description.


# removeRigidBody()

Deletes the object's current rigid body and any attached colliders. Called automatically when the actor is destroyed.

# createCollider(colliderDesc)

Create a new collider and attaches it to the object's rigid body. Objects can have multiple colliders at the same time. Takes as its argument a Rapier collider description (see the Rapier docs for more information.)

Name Type Description
colliderDesc ColliderDesc
const cd = RAPIER.ColliderDesc.cuboid(0.5, 0.5, 0.5);