fixed intersect.balance_from_mass crashing with nil/false mass

This commit is contained in:
Max Cahill 2024-03-07 11:39:44 +11:00
parent ef4ef69b0f
commit 19bb169e55

View File

@ -521,8 +521,8 @@ end
-- returns false if we're colliding two static bodies, as that's invalid -- returns false if we're colliding two static bodies, as that's invalid
function intersect.balance_from_mass(a_mass, b_mass) function intersect.balance_from_mass(a_mass, b_mass)
--static cases --static cases
local a_static = a_mass <= 0 or a_mass == math.huge or not a_mass local a_static = not a_mass or a_mass <= 0 or a_mass == math.huge
local b_static = b_mass <= 0 or b_mass == math.huge or not a_mass local b_static = not b_mass or b_mass <= 0 or b_mass == math.huge
if a_static and b_static then if a_static and b_static then
return false --colliding two static bodies return false --colliding two static bodies
elseif a_static then elseif a_static then