Get a free and open source physics library in BEPUphysics (for Windows, XBox and WP7)


Today's project is a physics engine, that's free, open source and cross Microsoft platform. And as you'd expect, not only do you get this cool engine, but a wide sample of demo's too. The scope of this engine is daunting, yet in looking at the code in the samples and the documentation, it looks very approachable too.

BEPUphysics FAQ

What is BEPUphysics?

BEPUphysics is a free, open source, 3D physics library for XNA, licensed under Apache 2.0. It's pretty darn fast too. We think you'll like it. You can download it here. Give it a try!

Can I make a closed source, commercial product with BEPUphysics?

Yep, free of charge.

Is the Apache 2.0 license compatible with the Windows Phone Marketplace?


Are the developers of BEPUphysics gonna disappear now, since it's open source?


I licensed BEPUphysics underneath an old contract that wasn't free. How does that affect things?

All pending and future royalties are waived. All licensees are allowed to move to the Apache 2.0 license.

Help me! I need help with BEPUphysics.

One of the best places to get help with BEPUphysics is on the forums. We like it when people post questions there, because everybody gets to learn.

No. I need secret, advanced, super-hi-tech support for BEPUphysics.

Wow wee! Go here then.

You seem like good people. I want to donate a few bucks.

Wow wee! Go here then.

What's your favourite coloure?


BEPUphysics is a 3D physics library by BEPU. It’s fast and has a bunch of cool features like constraints, terrain, static and instanced meshes, continuous collision detection, custom collision rules, vehicles, easy multithreading, yadda yadda yadda. Full support for XBox360 and WP7 too!

The engine's primary version is for XNA, but there is a SlimDX fork and a dependency free fork if you don't want to use XNA.

Just starting out? Check out the Getting Started tutorial in the documentation section.

To get a feel for the engine check this out;

Demo's were mentioned? Here's a snap of them;


Looking at the Jenga demo;



The code to execute this demo?

public JengaDemo(DemosGame game)
    : base(game)

    //Have to shrink the ball a little to make it fit between jenga tower blocks.
    kapow = new Sphere(new Vector3(-11000, 0, 0), .2f, 20);
    kapow.PositionUpdateMode = PositionUpdateMode.Continuous; //The ball's really tiny! It will work better if it's handled continuously.
    int numBlocksTall = 18; //How many 'stories' tall.
    float blockWidth = 3f; //Total width/length of the tower.
    float blockHeight = 1 / 2f;
    Entity toAdd;

    //The default number of iterations is 10, which works fine, but this demo
    //is all about stability (it's jenga!).  Increase the iterations a bit.
    //Even though it's using twice as many iterations, it will early-out
    //before reaching the limit MOST of the time.
    //It's still pretty playable at around 7-8 max iterations, though.
    Space.Solver.IterationLimit = 20;

    for (int i = 0; i < numBlocksTall; i++)
        if (i % 2 == 0)
            for (int j = 0; j < 3; j++)
                toAdd = new Box(new Vector3(
                                    j * (blockWidth / 3) - blockWidth / 3f,
                                    blockHeight / 2 + i * (blockHeight),
                                blockWidth / 3, blockHeight, blockWidth, 10);
            for (int j = 0; j < 3; j++)
                toAdd = new Box(new Vector3(
                                    blockHeight / 2 + (i) * (blockHeight),
                                    j * (blockWidth / 3) - blockWidth / 3f),
                                blockWidth, blockHeight, blockWidth / 3, 10);

    Space.Add(new Box(new Vector3(0, -.5f, 0), 40, 1, 40));
    game.Camera.Position = new Vector3(0, 5, 15);


Yep, that's it.

Let's take a quick peek at the engine itself.


One of the things I thought kind of cool was the Vehicle stuff.


If you're looking for a physics engine or just interested in seeing how one is built, this project looks to be one that should be at the top of your list.

The Discussion

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.