This project has moved and is read-only. For the latest updates, please go here.

Ray casting detection. Has anyone implemented?

Jan 12, 2009 at 8:10 PM

I was just curious if anyone had implemented their own version of ray casting for collision detection purposes and if so do you have any pointers on how you went about it. I have implemented a few methods including using sensors and a detection manager class but all of them have been fairly limited. The ideal functionality would be to call a method "CheckRayCollision(out Vector2 colPos);" which would return a bool value if it collided with something and fill also pass back the Vector2 of the nearest collision point. I am just getting ready to begin technique number 3 on attempting this myself and figured I would check to see if anyone had any insight into this issue before I began.

Thanks in advance for any help you are able to provide.
Jan 12, 2009 at 8:21 PM
You might want to have a look at Box2D and maybe talk with BorisTheBrave from their forums about it. They have implemented a raycasting feature. You might be lucky if Box2DX (A C# port of Box2D) has implemented it. It's worth a try.

Be sure to keep us posted on your progress. If you manage to create a decent implementation, we will consider putting it into Farseer Physics. We do already have raycasting on our todo list, but it might take quite a while.