From d2b7f0d96242be3fec520b7ed8e59982d4deb399 Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Sun, 8 Apr 2018 14:52:21 +0200 Subject: [PATCH] Fix #38 --- shapes.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/shapes.lua b/shapes.lua index 29fb01d..f5422cd 100644 --- a/shapes.lua +++ b/shapes.lua @@ -256,8 +256,9 @@ end -- point shape intersects ray if it lies on the ray function PointShape:intersectsRay(x,y, dx,dy) local px,py = self._pos.x-x, self._pos.y-y - local t = vector.dot(px,py, dx,dy) / vector.len2(dx,dy) - return t >= 0, t + local t = px/dx + -- see (px,py) and (dx,dy) point in same direction + return (t == py/dy), t end function PointShape:intersectionsWithRay(x,y, dx,dy)