HardonCollider and ray collisions
Posted: Fri Jul 08, 2011 6:49 pm
Hello!
I want to "fire" a ray from one set of co-ordinates to another set of co-ordinates and detect whether there is a collision along the length of the ray and if so, where that collision has occurred. The number of objects that could potentially collide with the ray number in the low hundreds.
I know HardonCollider fortunately has the handy "function shape:intersectsRay(x, y, dx, dy)" to test for a collision with a particular shape; my question is: is iterating through all of the potential objects which might collide with the ray the best way of doing this or am I just being an idiot and there's a much better way?
I want to "fire" a ray from one set of co-ordinates to another set of co-ordinates and detect whether there is a collision along the length of the ray and if so, where that collision has occurred. The number of objects that could potentially collide with the ray number in the low hundreds.
I know HardonCollider fortunately has the handy "function shape:intersectsRay(x, y, dx, dy)" to test for a collision with a particular shape; my question is: is iterating through all of the potential objects which might collide with the ray the best way of doing this or am I just being an idiot and there's a much better way?