-
- All Implemented Interfaces:
public final class WorldClass for creating a world with iterative solver structure.
-
-
Method Summary
Modifier and Type Method Description final ArrayList<TranslatableBody>getBodies()final UnitsetBodies(ArrayList<TranslatableBody> bodies)final ArrayList<Arbiter>getContacts()final UnitsetContacts(ArrayList<Arbiter> contacts)final Vec2getGravity()final UnitsetGravity(Vec2 gravity)final <T extends Any> TaddBody(T b)Adds a body to the world final UnitremoveBody(TranslatableBody b)Removes a body from the world. final JointaddJoint(Joint j)Adds a joint to the world. final UnitremoveJoint(Joint j)Removes a joint from the world. final Unitstep(Double dt)The main time step method for the world to conduct an iteration of the current world call this method with a desired time step value. final UnitclearWorld()Clears all objects in the current world final UnitgravityBetweenObj()Applies gravitational forces between to objects (force applied to centre of body) -
-
Constructor Detail
-
World
World(Vec2 gravity)
- Parameters:
gravity- The strength of gravity in the world.
-
-
Method Detail
-
getBodies
final ArrayList<TranslatableBody> getBodies()
-
setBodies
final Unit setBodies(ArrayList<TranslatableBody> bodies)
-
getContacts
final ArrayList<Arbiter> getContacts()
-
setContacts
final Unit setContacts(ArrayList<Arbiter> contacts)
-
getGravity
final Vec2 getGravity()
-
setGravity
final Unit setGravity(Vec2 gravity)
- Parameters:
gravity- The strength of gravity in the world.
-
removeBody
final Unit removeBody(TranslatableBody b)
Removes a body from the world.
- Parameters:
b- The body to remove from the world.
-
removeJoint
final Unit removeJoint(Joint j)
Removes a joint from the world.
- Parameters:
j- The joint to remove from the world.
-
step
final Unit step(Double dt)
The main time step method for the world to conduct an iteration of the current world call this method with a desired time step value.
- Parameters:
dt- Timestep
-
clearWorld
final Unit clearWorld()
Clears all objects in the current world
-
gravityBetweenObj
final Unit gravityBetweenObj()
Applies gravitational forces between to objects (force applied to centre of body)
-
-
-
-