mirror of
https://github.com/vrld/HC.git
synced 2024-11-18 12:54:23 +00:00
Fix #38
This commit is contained in:
parent
89c6b1a6b2
commit
d2b7f0d962
@ -256,8 +256,9 @@ end
|
|||||||
-- point shape intersects ray if it lies on the ray
|
-- point shape intersects ray if it lies on the ray
|
||||||
function PointShape:intersectsRay(x,y, dx,dy)
|
function PointShape:intersectsRay(x,y, dx,dy)
|
||||||
local px,py = self._pos.x-x, self._pos.y-y
|
local px,py = self._pos.x-x, self._pos.y-y
|
||||||
local t = vector.dot(px,py, dx,dy) / vector.len2(dx,dy)
|
local t = px/dx
|
||||||
return t >= 0, t
|
-- see (px,py) and (dx,dy) point in same direction
|
||||||
|
return (t == py/dy), t
|
||||||
end
|
end
|
||||||
|
|
||||||
function PointShape:intersectionsWithRay(x,y, dx,dy)
|
function PointShape:intersectionsWithRay(x,y, dx,dy)
|
||||||
|
Loading…
Reference in New Issue
Block a user