opensourceprojects.dev

A broadsheet for software that doesn't ask for your email

Bepuphysics v2: A C# 3D physics engine with CCD, sleeping, and character control...
GitHub RepoImpressions3

Project Description

View on GitHub

Bepuphysics v2: A Serious C# Physics Engine That Doesn’t Suck

If you’ve ever tried to shove a physics engine into a C# game or simulation, you know the pain. Most options are either wrappers around native C++ libraries (hello, P/Invoke overhead), abandonware, or written for Unity’s closed ecosystem. Bepuphysics v2 is none of those things. It’s a pure C# 3D physics engine that’s fast, modern, and surprisingly capable — no GC pauses, no native interop, and no weird JIT magic. Let’s dig in.


What It Does

At its core, bepuphysics v2 simulates rigid bodies in 3D space. Collision detection, constraints, joints — the usual stuff. But it’s not just another Havok clone. It gives you:

  • Continuous Collision Detection (CCD) to prevent fast-moving objects from tunneling through walls.
  • Sleeping for static or slow objects, so the engine doesn’t waste CPU cycles on things that don’t move.
  • Character controllers out of the box, ready for first-person or third-person movement.
  • Multithreading support (it’s not just parallel, it’s designed for it from the ground up).
  • Deterministic simulation, which is rare for a C# engine — great for replays or networked games.

The solver type is an impulse-based sequential impulse solver (similar to Box2D or Bullet), so the behavior is predictable and responsive.


Why It’s Cool

  1. Pure C# with zero GC allocations.
    The engine uses a custom pool system and avoids boxing like the plague. No garbage collection spikes. You can simulate thousands of bodies without frame drops.

  2. No Unity/Unreal lock-in.
    It’s a standalone .NET library. Use it in your own game engine, a scientific simulation, a Blender add-on, or even a console app.

  3. CCD that actually works.
    Many C# engines fake CCD or make it optional. Bepuphysics v2 builds it into the solver pipeline. Fast bullets, tiny debris, crazy angular velocities — it swallows them all without ghosting.

  4. Sleeping without the bugs.
    Sleeping often breaks physics: objects wake up at the wrong time, or they drift. This engine handles it gracefully. Objects stay asleep until something actually touches them.

  5. Active development and good docs.
    The repo has a book-length documentation site (yes, actually book-length) covering everything from “how to create a world” to “advanced constraint customization.”


How to Try It

You can grab it via NuGet:

dotnet add package Bepuphysics

Or clone the repo and run the demos:

git clone https://github.com/bepu/bepuphysics2.git
cd bepuphysics2/Demos
dotnet run

The demos project ships with a bunch of examples: ragdolls, cars, stacking pyramids, character movement — all rendered with a simple OpenGL-like setup. It’s the fastest way to see what the engine can do.

Quick start (barebones C# code):

using BepuPhysics;
using BepuUtilities;

var simulation = Simulation.Create(BufferPool.Default, new DefaultCallbacks());

var bodyHandle = simulation.Bodies.Add(BodyDescription.CreateDynamic(
    new RigidPose(new Vector3(0, 10, 0)), 
    new BodyInertia { InverseMass = 1f / 10f }, 
    new CollidableDescription(new TypedIndex(0, 0), 0.1f), 
    new BodyActivityDescription(0.01f)));

// Step the simulation
simulation.Timestep(1 / 60f);

That’s it. Ten lines of code, and you have a physics world with a falling cube.


Final Thoughts

Bepuphysics v2 is one of those rare open source projects that feels professional. It’s not trying to be a toy or a Unity asset — it’s a production-ready engine that happens to be written in C#. If you’re making a game in a custom engine, building a robot simulator, or just want to see how a well-designed C# physics stack works, this is worth your time.

The lack of a built-in renderer is a feature, not a bug. You bring your own graphics. That makes it flexible enough to fit into almost any .NET project.

Also, the fact that the character controller works out of the box is a huge time-saver. No fiddling with friction values or “slidey” ground collisions. You just get a character that walks up stairs and doesn’t skate.

Go grab it. Play with the demos. Read the docs. It’s good stuff.

Found via @githubprojects

Back to Projects
Project ID: 64664eb1-5dcf-4162-9494-ef1925394bebLast updated: July 12, 2026 at 05:47 AM