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.
Follow the steps below to master the technique of using BoundingSphere
in your game:
1. Create a Windows Phone Game project named
BoundingSphereCollision
and changeGame1.cs
toBoundingSphereCollisionGame.cs
. Then, create a Content Pipeline Extension Library namedMeshVerticesProcessor
and replace theContentProcessor1.cs
withMeshVerticesProcessor.cs
. After that, add the model fileBallLowPoly.FBX
to the content project.2. Define the
MeshVerticesProcessor
class inMeshVerticesProcessor.cs
of theMeshVerticesProcessor
project. The...