Run multithreaded rigid body physics for games and VR
Imagine a game scene where hundreds of objects move simultaneously without physics calculations blocking the main thread. Jolt Physics is a rigid body physics and collision detection library for game and VR applications. Used in major titles like Horizon Forbidden West and Death Stranding 2: On the Beach, this tool handles complex physics simulations efficiently.
Design for parallel operation with the main thread
It is designed to address the limitations of parallel processing in existing physics engines. Access to physics data is optimized to occur simultaneously with the main simulation update. Placing objects or running collision queries on background threads is handled without locking, minimizing performance impact. Collision detection is divided into a broad phase and a narrow phase, which run in parallel. This allows time-consuming tasks, such as navigation mesh generation, to be distributed across multiple frames.
Support for various objects and constraints
It supports various rigid body shapes, including spheres, boxes, capsules, cones, cylinders, convex hulls, planes, compounds, meshes, and terrain. It provides a wide range of constraints, such as fixed, point, distance (including springs), hinge, slider, cone, rack and pinion, gear, pulley, smooth spline path, swing-twist (for human shoulders), and 6 DOF. Constraints can be driven by motors, and it supports sensors (trigger volumes) and animated ragdolls. Character simulation is available via two methods: capsule-based rigid body characters and virtual characters. Vehicle simulation supports wheeled, tracked, and motorcycle types, while soft body simulation, GPU-based hair simulation, and hydrodynamic buoyancy calculations are also possible.
Platform and compiler requirements
It supports Windows, Linux, FreeBSD, Android, macOS, iOS, MSYS2 MinGW64, WebAssembly, and specific game consoles (Platform Blue). On x86/x64 architectures, SSE2 is the minimum requirement, and it can be compiled with SSE4.1, SSE4.2, AVX, AVX2, and AVX512. On ARM64 (AArch64), it uses NEON and is compatible with Armv8-A. On ARM32 (AArch32), it does not use special CPU instructions. It compiles with Visual Studio 2022 or later, Clang 16 or later, and GCC 12 or later, using C++ 17. It depends only on the Standard Template Library and does not use RTTI or exceptions.
Suitable projects and considerations
It is suitable for games or VR simulations where you need to implement a physics engine directly or when the parallel processing performance of an existing engine is insufficient. Deterministic simulation allows replicating the simulation to remote clients by replicating only inputs, which is advantageous for network games. However, since this library approximates real-world rigid body behavior, it should primarily be used for games or VR. It is distributed under the MIT license, allowing commercial use. Bindings are available for various languages, including C, C#, Java, Kotlin, JavaScript, Rust, Python, Zig, and Jai, and engine integration plugins exist for Godot, Source Engine, and Unreal Engine. If contributing large changes, you must first discuss them in GitHub Discussions and agree to the Contributor Agreement.