vrld / HC

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

intersectsRay says a shape is intersecting when it isnt #40

Closed zell2002 closed 9 years ago

zell2002 commented 9 years ago

I have a startLocation and endLocatioin

-- green line love.graphics.line(startLocation.x, startLocation .y, endLocatioin.x, endLocatioin.y)

i then do the following, and get all shapes within that range, then loop just those checking if they inertsect with my line

for shape in pairs(hc:shapesInRange(startLocation, endLocatioin) do local inter = shape:intersectsRay(startLocation.x, startLocation.y, endLocatioin.x, endLocatioin.y) if inter then local sx, sy = shape:center() -- red line love.graphics.line(startLocation.x, startLocation.y, sx, sy) end end

the first Green line draws correctly then the red lines draw correctly, bar 1 shape which always gets "intersected" even though it is no where near the Green line it is within the shapesInRange() but it does not get intersected at all - that I can see

Not sure if this is a bug, or I'm misunderstanding something?

Great lib either way, I use your hump lib all the time ! : )