Class: RigidBodyUtil
Defined in: packages/physics/utils/RigidBodyUtil.ts:8
Provides a set of methods related to AMMO rigid bodies
Constructors
Constructor
new RigidBodyUtil():
RigidBodyUtil
Returns
RigidBodyUtil
Methods
createRigidBody()
staticcreateRigidBody(object3D,shape,mass,position?,rotation?):btRigidBody
Defined in: packages/physics/utils/RigidBodyUtil.ts:18
Creates an Ammo rigid body.
Parameters
object3D
Object3D
The 3D object.
shape
The collision shape.
mass
number
The mass of the collision body.
position?
Vector3
Optional parameter, the position of the rigid body; defaults to the 3D object's localPosition.
rotation?
Vector3 | Quaternion
Optional parameter, the rotation of the rigid body; defaults to the 3D object's localRotation.
Returns
The newly created Ammo.btRigidBody object.
updateTransform()
staticupdateTransform(bodyRb,position,rotation,clearFV?):void
Defined in: packages/physics/utils/RigidBodyUtil.ts:46
Updates the position and rotation of the rigid body. This function applies the new position and rotation to the rigid body.
Parameters
bodyRb
The rigid body object.
position
Vector3
The new position of the rigid body, expressed as a Vector3.
rotation
Vector3 | Quaternion
The new rotation of the rigid body, optional; can be a Vector3 representing Euler angles (automatically converted to a quaternion); defaults to a zero quaternion.
clearFV?
boolean
Whether to clear forces and velocities, optional; defaults to false.
Returns
void
updatePosition()
staticupdatePosition(bodyRb,value):void
Defined in: packages/physics/utils/RigidBodyUtil.ts:68
Updates the position of the rigid body
Parameters
bodyRb
value
Vector3
Returns
void
updateRotation()
staticupdateRotation(bodyRb,value):void
Defined in: packages/physics/utils/RigidBodyUtil.ts:84
Updates the rotation of the rigid body
Parameters
bodyRb
value
Vector3
Returns
void
updateScale()
staticupdateScale(bodyRb,value,mass):void
Defined in: packages/physics/utils/RigidBodyUtil.ts:101
Updates the scale of the rigid body
Parameters
bodyRb
value
Vector3
mass
number
Returns
void
clearForcesAndVelocities()
staticclearForcesAndVelocities(bodyRb):void
Defined in: packages/physics/utils/RigidBodyUtil.ts:116
Clears forces and velocities
Parameters
bodyRb
Returns
void
activateCollisionBodies()
staticactivateCollisionBodies():void
Defined in: packages/physics/utils/RigidBodyUtil.ts:125
Activates all collision pairs in the physics world
Returns
void
destroyRigidBody()
staticdestroyRigidBody(bodyRb):void
Defined in: packages/physics/utils/RigidBodyUtil.ts:149
Destroys the rigid body along with its motion state and collision shape
Parameters
bodyRb
Returns
void
destroyConstraint()
staticdestroyConstraint(constraint):void
Defined in: packages/physics/utils/RigidBodyUtil.ts:162
Destroys a constraint
Parameters
constraint
Returns
void

