Skip to main content
Methods for applying external forces and torques to bodies.

applyForce(bodyName, force, point?)

Apply a force to a body at an optional point.
string
required
Name of the body to apply force to.
THREE.Vector3
required
Force vector in world coordinates (Newtons).
THREE.Vector3
Application point in world coordinates. If omitted, force is applied at the body’s center of mass.

applyTorque(bodyName, torque)

Apply a pure torque to a body.
string
required
Name of the body.
THREE.Vector3
required
Torque vector in world coordinates (N·m).

setExternalForce(bodyName, force, torque)

Set both force and torque on a body via xfrc_applied.
string
required
Name of the body.
THREE.Vector3
required
Force vector (N).
THREE.Vector3
required
Torque vector (N·m).
xfrc_applied layout per body is [torque(3), force(3)]. This method writes both components.

applyGeneralizedForce(values)

Apply forces in generalized (joint) coordinates.
Float64Array | number[]
required
Array of length model.nv with forces/torques in generalized coordinates.

Important: Force Lifecycle

The provider zeros qfrc_applied at the start of each frame. Forces applied via these API methods (or useBeforePhysicsStep) only persist for one physics step. To apply a continuous force, call it every frame:

setCtrl(nameOrValues, value?)

Set actuator controls by name or as a batch.
string | Record<string, number>
required
Actuator name (with value param) or object mapping names to values.
number
Control value (when nameOrValues is a string).

getCtrl()

Get all actuator control values.
Returns: Float64Array