[fixed] broken intersect.circle_circle_collide result

This commit is contained in:
Max Cahill 2021-04-13 15:38:40 +10:00
parent 6eb979a68c
commit ab0839430a

View File

@ -55,7 +55,7 @@ function intersect.circle_circle_collide(a_pos, a_rad, b_pos, b_rad, into)
into = vec2:zero() into = vec2:zero()
end end
--normalise, scale to separating distance --normalise, scale to separating distance
into:vset(_ccc_delta):sdiv(dist):smuli(rad - dist) into:vset(_ccc_delta):sdivi(dist):smuli(rad - dist)
return into return into
end end
return false return false
@ -97,7 +97,7 @@ function intersect._line_displacement_to_sep(a_start, a_end, separation, total_r
if sep <= 0 then if sep <= 0 then
if distance <= COLLIDE_EPS then if distance <= COLLIDE_EPS then
--point intersecting the line; push out along normal --point intersecting the line; push out along normal
separation:vset(a_end):vsub(a_start):normalisei():rot90li() separation:vset(a_end):vsubi(a_start):normalisei():rot90li()
else else
separation:smuli(-sep) separation:smuli(-sep)
end end