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 BoundingSphere collision detection in a 3D game

Unlike the bounding box, bounding sphere based collision detection is faster. The technique just needs to compute the length between two points or vertices whether less, equal, or greater than the sum of radii. In modern games, bounding sphere based collision detection is preferred rather than the bounding box. In this recipe, you will learn how to use the technique in an XNA application.

How to do it...

Follow the steps below to master the technique of using BoundingSphere in your game:

  1. Create a Windows Phone Game project named BoundingSphereCollision and change Game1.cs to BoundingSphereCollisionGame.cs. Then, create a Content Pipeline Extension Library named MeshVerticesProcessor and ...

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