Note: Source code is now available via github: http://github.com/bretternst/henge3d
Henge3D is a 3D physics library written in C# for XNA. It is implemented entirely in managed code and is compatible with the XBOX 360.
- Rigid body simulation with collision detection, response, and approximated friction.
- Supports collision skins consisting of arbitrary convex polyhedra, spheres, capsules and planes. Collision detection against triangle meshes is also supported.
- Supports a number of constraints, including body point constraints, revolute joints, universal joints, prismatic joints, etc.
- Multi-threaded collision detection and collision response.
- Ability to import collision skins from Blender and potentially other modeling programs.
- Supports ragdolls using collections of rigid bodies with constraints (see the Holodeck program for examples).
I don't claim to have invented any of the math or concepts used in this library. A very big THANKS and a bunch of credit should go to the following people:
- Erin Catto (creator of Box2D): The information from Erin's GDC slides was extremely valuable, as were a number of Erin's forum posts. Henge3D uses the accumulated impulse techniques described in the slides. Box2D is a fantastic engine and helped
me in more ways than I can count.
- David Eberly (author of the book Game Physics): Chapter 5, in particular, was wonderful in helping to get me started. He goes into great depth about the math involved in physics engines and even provided some great info on collision detection with polyhedra.
- Christer Ericson (author of Real-Time Collision Detection): This book is the first place I look if I'm having trouble with collisions. It's my collision detection toolbox. In particular, the wide array of primitive tests outlined in a clear and
concise fashion was invaluable.
- The JigLib and JigLibX folks: Their excellent engine provided a lot of inspiration and was a great sanity check against my own work. You will find a number of similarities in architecture between JigLib(X) and Henge3D. Everyone shopping for a 3D physics
engine should check theirs out.
- The Bullet folks: Not only were there a lot of great posts on their forum, but their generic 6D-of-freedom constraint inspired the one in my own engine (heck, the constraint could almost be called a port, it's so similar). A top-notch engine for the
native C/C++ world.
API Documentation currently comes in the form of a sample project (Holodeck) and fairly thorough Intellisense comments. More formal documentation may be produced if there is interest in this project. I can also answer questions here on the discussion board.
To use the Holodeck sample:
- Hold down the right mouse button and drag the mouse to turn the camera
- Use the standard WASD keys to move around.
- Press space to spawn the selected object.
- Use the 1 through 9 keys to cycle through the pre-constructed scenes.
- Press R to spawn a ragdoll.
- Hold down the middle mouse button when the cursor is over an object in order to drag it around.
- Note: The attached WPF side-panel can sometimes be a little wonky. If you press a key such as space and nothing happens, try clicking on the game window to make sure it has focus.
...and on the 360:
- Press A to shoot blocks.
- Press B to spawn ragdolls.
- Press the left and right bumpers to cycle to new scenes.
- Press Back to exit.
- Press X to pause or unpause the engine.
- Press Y to move the scene forward one step while the engine is paused.