12,179
stars
+0+23+517
1,005
forks
118
watchers
–
prs
–
issues
16
releases
–
discussions
README
Jolt Physics A multi core friendly rigid body physics and collision detection library. Suitable for games and VR applications. Used by Horizon Forbidden West and Death Stranding 2: On the Beach. || |:-| |A YouTube video showing a ragdoll pile simulated with Jolt Physics.| For more demos and videos go to the Samples section. Design considerations Why create yet another physics engine? Firstly, it has been a personal learning project. Secondly, I wanted to address some issues that I had with existing physics engines: Games do more than simulating physics. These things happen across multiple threads. We emphasize on concurrently accessing physics data outside of the main simulation update: Sections of the simulation can be loaded / unloaded in the background. We prepare a batch of physics bodies on a background thread without locking or affecting the simulation. We insert the batch into the simulation with a minimal impact on performance. Collision queries can run parallel to adding / removing or updating a body. If a change to a body happened on the same thread, the change will be immediately visible. If the change happened on another thread, the query will see a consistent before or after state. An alternative would be to have a read and write version of the world. This prevents changes from being visible immediately, so we avoid this. Collision queries can run parallel to the main physics simulation. We do a coarse check (broad phase query) before the simulation step and do fine checks (narrow phase query) in the background. This way, long running processes (like navigation mesh generation) can be spread out across multiple frames. Accidental wake up of bodies cause performance problems when loading / unloading content. Therefore, bodies will not automatically wake up when created. Neighboring bodies will not be woken up when bodies are removed. This can be triggered manually if desired. The simulation runs deterministically. You can replicate a simulation to a remote client by merely replicating the inputs to the simulation. Read the Deterministic Simulation section to understand the limits. We try to simulate behavior of rigid bodies in the real world but make approximations. Therefore, this library should mainly be used for games or VR simulations. Features Simulation of rigid bodies of various shapes using continuous collision detection: Sphere Box Capsule Tapered-capsule Cylinder Tapered-cylinder Convex hull Plane Compound Mesh (triangle) Terrain (height field) Simulation of constraints between bodies: Fixed Point Distance (including springs) Hinge Slider (also called prismatic) Cone Rack and pinion Gear Pulley Smooth spline paths Swing-twist (for humanoid shoulders) 6 DOF Motors to drive the constraints. Collision detection: Casting rays. Testing shapes vs shapes. Casting a shape vs another shape. Broadphase only tests to quickly determine which objects may int