Module org.dyn4j

Package org.dyn4j.dynamics

Package containing the dynamics engine.

The dynamics engine is an impulse based rigid body physics simulator. The simulation by default uses SI (m/kg/s) units. This can be changed, but all settings within the Settings singleton must be set to the new units. Instead its recommended to use the UnitConversion class to convert all values to MKS.

A constraint based approach is used to solving contacts and joints.

Create a World object to gain access the dynamics engine. Create Bodys and add them to the World. Add the World.update(double) method to your game loop (notice the World.update(double) method requires the elapsed time to be in seconds).

Upon creating a World a Bounds object may be supplied. The Bounds will determine when Bodys go out of bounds and deactivate them. Using the World() constructor will create a world that has no bounds, in which case the World.getBounds() method will return null.

A World object also contains a number listeners that can be used to respond to events that happen within the world, contact for instance.

Please read the respective documentation on each listener. Certain operations on the World object may not be allowed inside the listener methods.

The gravity of the World object can be changed, and can be in any direction via the World.setGravity(org.dyn4j.geometry.Vector2) method.

The dynamics engine may require some configuration. The defaults should cover most applications, however, they can be changed using the Settings class on the World. Any setting can be changed at runtime so that no source code modification is needed. Refer to the source of Settings and the Sandbox for details on what each individual setting controls.

Since:
1.0.0
Version:
3.2.0
Author:
William Bittle
Skip navigation links