World

class World(gravity: Vec2)

Class for creating a world with iterative solver structure.

Parameters

gravity

The strength of gravity in the world.

Constructors

Link copied to clipboard
fun World(gravity: Vec2 = Vec2())

Functions

Link copied to clipboard
fun <T> addBody(b: T): T

Adds a body to the world

Link copied to clipboard
fun addJoint(j: Joint): Joint

Adds a joint to the world.

Link copied to clipboard
fun clearWorld()

Clears all objects in the current world

Link copied to clipboard
fun gravityBetweenObj()

Applies gravitational forces between to objects (force applied to centre of body)

Link copied to clipboard
fun removeBody(b: TranslatableBody)

Removes a body from the world.

Link copied to clipboard
fun removeJoint(j: Joint)

Removes a joint from the world.

Link copied to clipboard
fun step(dt: Double)

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.

Properties

Link copied to clipboard
var bodies: ArrayList<TranslatableBody>
Link copied to clipboard
var contacts: ArrayList<Arbiter>
Link copied to clipboard
var gravity: Vec2
Link copied to clipboard
var joints: ArrayList<Joint>