NewtonBodyGetForceAndTorqueCallback

From Newton Wiki
Revision as of 08:02, 10 June 2019 by WikiSysop (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

NewtonBodyGetForceAndTorqueCallback

NewtonApplyForceAndTorque NewtonBodyGetForceAndTorqueCallback(const NewtonBody* bodyPtr)

Usage

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

Parameters

  • const NewtonBody *bodyPtr - pointer to the body.

Return

  • pointer to the force call back.

Remarks

  • 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