Merge pull request #38 from radgeRayden/master

Fix intersect depending on exported mathx
This commit is contained in:
Max Cahill 2021-10-26 10:06:40 +11:00 committed by GitHub
commit 65d8f24a45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,6 +17,7 @@
local path = (...):gsub("intersect", "") local path = (...):gsub("intersect", "")
local vec2 = require(path .. "vec2") local vec2 = require(path .. "vec2")
local mathx = require(path .. "mathx")
--module storage --module storage
local intersect = {} local intersect = {}
@ -337,10 +338,10 @@ function intersect.aabb_aabb_collide(a_pos, a_hs, b_pos, b_hs, into)
--actually collided --actually collided
if abs_amount.x <= abs_amount.y then if abs_amount.x <= abs_amount.y then
--x min --x min
res = into:scalar_set(abs_amount.x * math.sign(delta.x), 0) res = into:scalar_set(abs_amount.x * mathx.sign(delta.x), 0)
else else
--y min --y min
res = into:scalar_set(0, abs_amount.y * math.sign(delta.y)) res = into:scalar_set(0, abs_amount.y * mathx.sign(delta.y))
end end
end end
return res return res