Fix PointShape:intersectsRay() - return true only of point on ray

This commit is contained in:
Matthias Richter 2011-02-26 17:43:22 +01:00
parent 787c980fdd
commit 736c9ba933

View File

@ -279,7 +279,8 @@ end
function PointShape:intersectsRay(x,y,dx,dy)
local p = self._pos - vector(x,y)
local d = vector(dx,dy)
return p * vector(dy, -dx), p * d / d:len2()
local t = p * d / d:len2()
return t >= 0, t
end
--