Members
# rigidBody
Returns the Rapier rigid body attached to this Wordcore object.
Methods
# 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. |
this.createRigidBody(RAPIER.RigidBodyDesc.newDynamic());
# 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);
cd.setRestitution(0.5);
cd.setFriction(0.8);
cd.setDensity(2.5);
this.createCollider(cd);