Constructor for a p2-es World
options for creating the world
Accumulator for the world
Enable to automatically apply body damping each step.
Enable to automatically apply gravity each step.
Enable to automatically apply spring forces each step.
All bodies in the world. To add a body to the world, use World.addBody.
The broadphase algorithm to use.
User-added constraints.
The ContactMaterials added to the World.
The default contact material to use, if no contact material was set for the colliding materials.
Dummy default material in the world, used in .defaultContactMaterial
Disabled body collision pairs. See World.disableBodyCollision.
Set to true if you want to the world to emit the "impact" event. Turning this off could improve performance.
Gravity to use when approximating the friction max force (mumassgravity).
Gravity in the world. This is applied on all bodies in the beginning of each step().
True if any bodies are not sleeping, false if every body is sleeping.
Whether to enable island splitting. Island splitting can be an advantage for both precision and performance.
For keeping track of what time step size we used last step
The narrowphase to use to generate contacts.
Overlap keeper for the world
How to deactivate bodies during simulation. Possible modes are: {@link World,NO_SLEEPING}, World.BODY_SLEEPING and World.ISLAND_SLEEPING. If sleeping is enabled, you might need to Body.wakeUp the bodies if they fall asleep when they shouldn't. If you want to enable sleeping in the world, but want to disable it for a particular body, see Body.allowSleep.
Enable/disable constraint solving in each step.
The solver used to satisfy constraints and contacts. Default is GSSolver.
All springs in the world. To add a spring to the world, use World.addSpring.
Is true during step().
World time.
If the length of .gravity is zero, and .useWorldGravityAsFrictionGravity=true, then switch to using .frictionGravity for friction instead. This fallback is useful for gravityless games.
Set to true if you want .frictionGravity to be automatically set to the length of .gravity.
Deactivate individual bodies if they are sleepy.
Deactivates bodies that are in contact, if all of them are sleepy. Note that you must enable World.islandSplit for this to work.
Never deactivate bodies.
Add a body to the simulation. Note that you can't add a body during step: you have to wait until after the step (see the postStep event). Also note that bodies can only be added to one World at a time.
Add a constraint to the simulation. Note that both bodies connected to the constraint must be added to the world first. Also note that you can't run this method during step.
Add a ContactMaterial to the simulation.
Add a spring to the simulation. Note that this operation can't be done during step.
Removes all bodies, constraints, springs, and contact materials from the world.
Emit an event.
The self object, for chainability.
Get a body by its id.
The body, or false if it was not found.
Get a contact material given two materials
Check if an event listener is added
Test if a world point overlaps bodies
Point to use for intersection tests
A list of objects to check for intersection
Used for matching against particles and lines. Adds some margin to these infinitesimal objects.
Array of bodies that overlap the point
Remove an event listener
The self object, for chainability.
Add an event listener
The self object, for chainability.
Ray cast against all bodies in the world.
true if any body was hit
Remove a body from the simulation. Note that bodies cannot be removed during step (for example, inside the beginContact event). In that case you need to wait until the step is done (see the postStep event).
Also note that any constraints connected to the body must be removed before the body.
Removes a constraint. Note that you can't run this method during step.
Removes a contact material
Remove a spring. Note that this operation can't be done during step.
Set the relaxation for all equations and contact materials.
Set the stiffness for all equations and contact materials.
Step the physics world forward in time.
There are two modes. The simple mode is fixed timestepping without interpolation. In this case you only use the first argument. The second case uses interpolation. In that you also provide the time since the function was last used, as well as the maximum fixed timesteps to take.
The fixed time step size to use.
The time elapsed since the function was last called.
Maximum number of fixed steps to take per function call.
The dynamics world, where all bodies and constraints live.