vrld / HC

General purpose collision detection library for the use with LÖVE.
http://hc.readthedocs.org/
404 stars 48 forks source link

intersectsRay not working for points? #38

Closed lzubiaur closed 6 years ago

lzubiaur commented 9 years ago

Hi, I can't get intersectsRay to work for point shapes. In the code below, I get false for the circle (correct) but returns true for the point.

 local hc = HC(100,nil,nil) 

 local circle = hc:addCircle(200,100,10)
 local i,t = circle:intersectsRay(0,0,10,0)
 print(i,t) -- Print false inf

 local point = hc:addPoint(200,100)
 local i,t = point:intersectsRay(0,0,10,0)
 print(i,t) -- Print true 20

Thank you in advance, Laurent

buckle2000 commented 7 years ago

A point has no volume by definition. You should use a small circle instead.