C4 Engine
C4 Engine API Documentation

Force::ApplyForce

Defined in:  C4Forces.h
Calculates the force to exert on a rigid body or deformable body.
Prototype

bool ApplyForce(RigidBodyController *rigidBody, const Transform4D& worldTransform, Vector3D *restrict force, Bivector3D *restrict torque);

Parameters
rigidBody The rigid body to which a force should be applied.
worldTransform The world transform representing the current state of the rigid body.
force A pointer to the location where the world-space force to apply should be written.
torque A pointer to the location where thr world-space torque to apply should be written.
Description
The Physics Manager calls the ApplyForce function for each rigid body that intersects the field to which the Force object is assigned. The ApplyForce function should determine what force and torque to exert on the rigid body and return it through the force and torque parameters. If the ApplyForce function exerts a force, then it should return true. If no force or torque is to be applied, then the ApplyForce function should return false.

The implementation of the ApplyForce function should not base the calculated forces on the world transform of the target node of the RigidBodyController object. The worldTransform parameter holds the world transform that should be used to determine the correct state of nodes composing the rigid body.
See Also

Field

RigidBodyController