NewtonUpdate

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

NewtonUpdate

void NewtonUpdate (const NewtonWorld* const newtonWorld, dFloat timestep)

Usage

Advances the simulation by an amount of time and waits for step to complete before returning control to your application (Single threaded).

Parameters

  • const NewtonWorld *newtonWorld - pointer to the Newton world
  • dFloat timestep - timestep in seconds

Description

This is the heart of the engine. This command updates the entire Newton world, by the amount of time passed (in seconds). This will collect (by calling ForceAndTorqueCallback) and apply any forces to NewtonBodies in the NewtonWorld, detect collisions, and eventually come up with the new positions and orientations for all bodies in the system (and again call the appropriate callbacks).

Remarks

  • Newton only accepts values for elapsed in the following range: 20fps < elapsed < 600fps. if you pass a value outside this range, it will be clamped. For more details see What value should I pass to "NewtonUpdate?

  • This function will advance the simulation by the amount of time specified by timestep. The Newton Engine does not perform sub-steps, and does not need tuning parameters. It is the responsibility of the application to ensure that timestep is small enough to guarantee physics stability.

Examples

//get elapsed time (depends on your system)
float elapsed = System->get_elapsed();
NewtonUpdate( mWorld, elapsed );

See also

NewtonInvalidateCache, NewtonUpdateAsync