March Docs

Arcade.Physics.Kinematics

Functions

fnballisticballistic(p : Vec2, v : Vec2, a : Vec2, dt : Float) : (Vec2, Vec2) needs ()#

One step of dt under acceleration a: the velocity first, then the position with the new velocity. Returns (position, velocity).

fnballistic_heightballistic_height(z : Float, vz : Float, g : Float, dt : Float) : (Float, Float) needs ()#

The same step on one axis under a pull of g toward minus: vz -. g *. dt, then z +. vz *. dt. Returns (height, vertical speed).

fnclamp_to_boundclamp_to_bound(x : Float, v : Float, bound : Float, restitution : Float) : Option((Float, Float)) needs ()#
fnintegrate_frictionintegrate_friction(p : Vec2, v : Vec2, pull : Vec2, decel : Float, dt : Float) : (Vec2, Vec2) needs ()#

One step of dt under pull, less a friction deceleration of decel against the direction of travel (none when the body is still). Returns (position, velocity).

fnreflectreflect(v : Vec2, n : Vec2, restitution : Float) : Vec2 needs ()#

v reflected off a surface with unit normal n, keeping restitution of the normal component: v - (1 + e) (v . n) n.