O'Reilly logo

Windows Phone 7 XNA Cookbook by Zheng Yang

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementing ray-triangle collision detection

Ray-triangle collision gives very accurate collision detection in games. Depending on the return value of the distance from the ray start position to the triangle, it is easy for you to decide whether a collision occurs. As you might know, all the models in 3D games are made of triangles, whether static or dynamic. The ray is like a bullet fired from a gun; here, you can consider the gun as another object, with a straight thin rope behind. Once the bullet hits the triangle an object, the collision happens. A lot of methods on ray-triangle are available; in this recipe, you will learn how to implement the method which has the best time and space complexity to make your game run faster with less memory ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required