NewtonBodyGetForce

From Newton Wiki
Jump to: navigation, search

NewtonBodyGetForce

void NewtonBodyGetForce( const NewtonBody* bodyPtr, dFloat* vectorPtr)

Usage

Get the net force applied to a rigid body.

Parameters

  • const NewtonBody *bodyPtr - pointer to the body.
  • const dFloat *forcePtr - pointer to an array of 3 floats to hold the net force of the body.

Return

  • Nothing.

Remarks

  • This function is only effective when called from NewtonApplyForceAndTorque callback.
  • 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 sta

See also

NewtonBodyAddForce NewtonBodySetForce