Class containing methods for performing Physics simulations on a World

Static methods

staticinlinecompute_velocity(v:Float, a:Float, d:Float, m:Float, dt:Float):Float

@:value({ advanced : false, percent_correction : 0.9, correction_threshold : 0.013 })staticinlineresolve(a:Body, b:Body, cd:CollisionData, correction_threshold:Float = 0.013, percent_correction:Float = 0.9, advanced:Bool = false):Void

Resolves a Collision between two Bodies, separating them if the conditions are correct.

Parameters:

a

the first Body in the Collision

b

the second Body in the Collision

cd

Data related to the Collision

staticseparate(world:World, ?listeners:Listeners):Void

Loops through all of a World's Listeners, separating all collided Bodies in the World. Use Collisions.query() before calling this to query the World's Listeners for collisions.

Parameters:

world
null

dt

staticstep(world:World, dt:Float):Void

Applies movement forces to a World's Bodies

Parameters:

world

World to step forward

dt

elapsed time since the last step

staticinlinestep_body(body:Body, dt:Float, gravity_x:Float, gravity_y:Float):Void