Using a physics engine
In this recipe, we will extend our existing mesh renderer to support the simulation of physics within a scene. We will continue to use the built-in Visual Studio graphics content pipeline, and rely on a simple mesh naming convention to designate static and dynamic objects within our scene.
Getting ready
For our physics engine, we will use BulletSharp, a .NET wrapper of the popular
Bullet Physics
library used in many AAA game and movie titles. Consider the following steps:
Download the
BulletSharp
library from https://code.google.com/p/bulletsharp/. It is also included in the\External
folder within the downloadable content for this book.Add a reference to the
\External\bulletsharp-2.82\Release SharpDX\BulletSharp.dll
assembly.Note
Referencing the
SharpDX
version of theBulletSharp
assembly uses the existingSharpDX
vector and matrix structures.We use an example scene to demonstrate the physics engine. This is available within the downloadable content.
A debug renderer...