mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-22 22:24:35 +00:00
[added] experimental intersect.bounce_off
(needs to be verified)
This commit is contained in:
parent
ab0839430a
commit
bfad0baba9
@ -418,4 +418,15 @@ function intersect.point_in_poly(point, poly)
|
||||
return wn ~= 0
|
||||
end
|
||||
|
||||
--resolution helpers
|
||||
|
||||
--bounce a velocity off of a normal (modifying velocity)
|
||||
local _bounce_temp = vec2()
|
||||
function intersect.bounce_off(velocity, normal)
|
||||
_bounce_temp:vset(velocity)
|
||||
velocity:vreji(normal)
|
||||
velocity:vsubi(_bounce_temp:vsubi(velocity))
|
||||
return velocity
|
||||
end
|
||||
|
||||
return intersect
|
||||
|
Loading…
Reference in New Issue
Block a user