collision v0.1.0 Collision.SeparatingAxis
Implements the separating axis theorem for collision detection.
Checks for collision by projecting all of the edges of a polygon against test axes, which are the normals of all the edges of both polygons that are being tested.
If there is any axis for which the projections aren’t overlapping, then the polygons are not colliding with one another. If all of the axes have overlapping projections, the polygons are colliding.
Summary
Functions
Check for collision between two polygons
Checks for collision between two polygons and, if colliding, calculates the minimum translation vector to move out of collision. The float in the return is the magnitude of overlap?
Types
Functions
Check for collision between two polygons.
Returns: true
| false
Specs
collision_mtv([axis], [axis]) :: {Collision.Vector.Vector2.t, number}
Checks for collision between two polygons and, if colliding, calculates the minimum translation vector to move out of collision. The float in the return is the magnitude of overlap?.
Returns: nil | {Vector2.t, float}