The SAT2D API is a collision and query API for the luxe: shape2D shapes and types.
It implements the “separating axis theorom” for collision. Note The return values in the API are not user friendly atm, this will improve.
They return lists with various values packed inside.
Check if two Shape2D instances are colliding. Returns a result with several values in a List.
The results include a separation value for x and y axis, which is how much to move shape1 to cancel
out the overlap. An example of using this: move a player shape2D collider, check for collision,
and then move them back by separation so that they do not collide anymore.
[
shape1, //the original shapes
shape2,
overlap, //amount the shapes overlap
separation_x, //the amount to separate on the x axis
separation_y, //the amount to separate on the y axis
SAT2D.collide_shapes(shape : Any, list : Any) : unknown
Like collide_shape for details on the results, but checks multiple shapes against a single one.
For example SAT2D.collide_shapes(player, walls), where walls is a list of Shape2D to collide against.
Note this returns a list of results, and each result is a list described by collide_shape.