From Newton Wiki
Jump to: navigation, search


NewtonApplyForceAndTorque NewtonBodyGetForceAndTorqueCallback(const NewtonBody* bodyPtr)


Return the pointer to the current force and torque call back function.


  • const NewtonBody *bodyPtr - pointer to the body.


  • pointer to the force call back.


  • This function can be used to concatenate different force calculation components making more modular the design of function components dedicated to apply special effect. For example a body may have a basic force a force that only apply the effect of gravity, but that application can place a region in where there can be a fluid volume, or another gravity field. we this function the application can read the correct function and save into a local variable, and set a new one. this new function will firs call the save function pointer and upon return apply the correct effect. this similar to the concept of virtual methods on objected oriented languages.
  • The function NewtonApplyForceAndTorque callback is called by the Newton Engine every time an active body is going to be simulated. The Newton Engine does not call the NewtonApplyForceAndTorque callback function for bodies that are inactive or have reached a state of stable equilibrium.

See also

NewtonBodyGetUserData NewtonBodyGetUserData NewtonBodySetForceAndTorqueCallback