Commit Graph

18 Commits

Author SHA1 Message Date
Max Cahill
af919da379 Fixed intersect.lua line functions not all working properly with un-exported batteries 2021-06-17 11:29:14 +10:00
Max Cahill
0bc9ccb17b Merge branch 'feature/minmax-vector-ops-and-aabb-collisions' 2021-06-08 11:53:09 +10:00
Max Cahill
a92a0c0351 Reworked aabb vs point and circle methods 2021-06-08 11:51:18 +10:00
Max Cahill
2d06ec7b9c [fixed] intersect.line_circle_overlap bug 2021-05-13 16:13:30 +10:00
Max Cahill
80c44f3436 [added] intersect.line_circle_overlap for checking boolean overlap circles vs lines 2021-05-13 12:24:45 +10:00
Max Cahill
af961ab2b8 [added] intersect.balance_from_mass which gets a normalised balance factor from two mass inputs, and treats <=0 or infinite or nil masses as static bodies 2021-05-11 15:47:48 +10:00
Aweptimum
b5d3707939 Added aabb_circle_collide routine, modify aabb_point_collide
If circle center within aabb, calls aabb_point collide. Then, adds to the msv the difference between the closest point on the aabb to the circle and the closest point on circle to closest point on the aabb.

It failed when the circle center was exactly on the aabb edges, so COLLIDE_EPS was added to the apo_normal in aabb_point_collide to force the point off the edge. As such, the "nudge" section was removed. This should definitely be reviewed.
2021-05-10 12:29:37 -04:00
Aweptimum
06ca04bde7 Added aabb_circle_overlap
When the distance between the circle's center and the closest point on the aabb is less than the circle radius, returns true.
2021-05-10 11:55:51 -04:00
Aweptimum
bfee65762e Added helper function for aabb_circle routines
Clamps point coords to the dimensions of an aabb to get the nearest point on the aabb. Returns two integers to avoid garbage.
2021-05-10 11:55:00 -04:00
Aweptimum
9d1e563796 Added aabb_point_collide()
Pushes point out along minimum axis. Nudges it out with COLLIDE_EPS added to the msv.
2021-05-10 11:53:40 -04:00
Max Cahill
c840bd01a5 [added] more intersection/resolution helpers 2021-04-14 13:32:14 +10:00
Max Cahill
bfad0baba9 [added] experimental intersect.bounce_off (needs to be verified) 2021-04-13 15:39:36 +10:00
Max Cahill
ab0839430a [fixed] broken intersect.circle_circle_collide result 2021-04-13 15:38:52 +10:00
Max Cahill
f6a2c9834f [added] nearest_point_on_line 2020-04-16 17:17:53 +10:00
Max Cahill
02568f8f08 [modified] intersect.lua imports vec2 unconditionally rather than attempting to use the global 2020-04-07 13:51:13 +10:00
Max Cahill
c7d96461cf [added] intersect.point_in_poly and required plumbing 2020-04-01 19:28:22 +11:00
Max Cahill
ad2fc71e7a [fixed] non-global compatible 2020-03-15 21:22:22 +11:00
Max Cahill
2f470cf7c7 initial commit 2020-01-29 14:26:28 +11:00