PDA

View Full Version : Implementing ray casting



gwartney
05-05-2016, 11:58 PM
Hey guys i wanted to know if any one could point me in the right place to learn how to implement ray casting. I have searched every where and i cant find any thing on the subject that is actually helpful or not outdated. I need it in order to drag 2d sprites around a screen. Any help would be much appreciated.

Hermannicus
05-07-2016, 07:14 AM
Hi,

I've never implemented ray casting myself, but I used it in physics engines like Bullet and Open Dynamics Engine. They are Open Source so you might want to learn from their code.

Here as a start:
http://ode-wiki.org/wiki/index.php?title=Manual:_Collision_Detection#Ray_Cl ass
http://bulletphysics.org/mediawiki-1.5.8/index.php/Using_RayTest

Or this might help for 2d from Box2D:
http://www.iforce2d.net/b2dtut/raycasting

Hope this helps.