Physics Engine Comparison: Rapier vs Godot vs Box2D/3D vs Jolt

Godot Rapier now runs on Rapier 0.35. As part of update, I have done a comparison between the following engines:

  • Rapier: using godot-rapier
  • Box2D: using godot-box2d-v3
  • Box3D: using godot-box3d
  • Jolt: using built in from Godot 4.7

Here is the repo used to run the tests benchmarks-repo.

Also, watch the video: https://youtu.be/wridqvuXTf4?si=mvDq-YZD5LX7u34N

2D: Rapier vs Box2D

Rapier is the only engine that keeps every scene stable: Box2D collapses the pyramid and blows the joints apart, those are marked as unstable.

Engine Version Addon
Rapier Rapier2D v0.35 godot-rapier2d
Box2D Box2D v3.1 godot-box2d-v3
Engine Rapier
Rapier2D
Box2D
Box2D
pyramid 16 ms
1.8 cores
17 ms
4.1 cores
unstable
smash 8 ms
2.2 cores
9 ms
4.4 cores
pile 7 ms
2.0 cores
6 ms
3.2 cores
queries 5.5 ms
1.2 cores
3.9 ms
1.8 cores
joints 6.4 ms
1.6 cores
3.8 ms
2.8 cores
unstable
Benchmark Conclusion
Pyramid Rapier hold the pyramid stable, 2.3x fewer cores. Box2D collapses, unstable
Smash Rapier 1.13x faster, 2.0x fewer cores
Mixed shape pile Box2D 1.23x faster, Rapier 1.6x fewer cores
Query storm Box2D 1.42x faster, Rapier 1.5x fewer cores
Joint grid Rapier holds the joints together; Box2D explodes, unstable

3D: Rapier vs Jolt vs Box3D

Rapier3D is fastest on three of five scenes and 4x ahead on queries; Jolt crashes the joint grid. Box3D is single threaded (issue on godot-box3d side).

Engine Version Addon
Rapier Rapier3D v0.35 godot-rapier3d
Jolt Jolt v5.5.0 ships with Godot v4.7
Box3D Box3D v0.1 godot-box3d v0.2.3
Rapier
Rapier3D
Jolt
Jolt
Box3D
Box3D
queries 5.6 ms
1.1 cores
22 ms
1.2 cores
6.3 ms
1.0 cores
pyramid 19 ms
3.4 cores
24 ms
5.6 cores
25 ms
0.9 cores
pile 10 ms
2.5 cores
11 ms
5.1 cores
14 ms
1.0 cores
joints 11.4 ms
2.3 cores
unstable
never finishes
11.2 ms
1.0 cores
smash 12 ms
2.9 cores
11 ms
5.0 cores
17 ms
1.0 cores
Benchmark Conclusion
Query storm Rapier 4.0x faster than Jolt, on par with Box3D
Pyramid Rapier 1.22x faster than Jolt, 1.27x than Box3D
Mixed shape pile Rapier 1.12x faster than Jolt, 1.37x than Box3D
Joint grid Rapier and Box3D tie; Jolt unstable, never finishes
Smash Jolt 1.05x faster, using 1.7x more cores

Building without experimental-threads

Official builds enable experimental-threads so the physics server can be driven from other threads. It costs 7-51% depending on the scene, so building from source without it is faster:

Benchmark Without threads Official build
2D box pyramid 16.4 ms 18.2 ms 11% faster
2D mixed pile 6.9 ms 8.0 ms 17% faster
2D joint grid 6.4 ms 7.4 ms 15% faster
3D box pyramid 19.4 ms 20.7 ms 7% faster
3D smash 12.0 ms 18.1 ms 51% faster
3D query storm 5.6 ms 8.0 ms 43% faster

New features

  • Rope and fixed joints, in 2D and 3D. Godot has no equivalent of either. Joints Reference.
  • Per-body solver iterations: stabilize one important body without paying for it globally. Rigidbodies Reference.
  • Per-joint stiffness and toggling: joint_set_softness, joint_set_enabled for breakable constraints. Joints Reference.
  • Joint warm starting: stiff joint assemblies converge much better, at no measurable cost.
  • New project settings for motion recovery, shape casting and query behaviour.

Full Changelog: godot-rapier-physics/CHANGELOG.md at main · appsinacup/godot-rapier-physics · GitHub

2 Likes

This is all very interesting. But when I click on all three “Reference” links, I get

Oops! That page doesn’t exist or is private.

1 Like

Uf, sorry, copy pasted it from my markdown article, and I think those didn’t copy well, updating now.
EDIT: Done.

1 Like

The first link [Joint Nodes] is working. The other two are now showing a different error.

Page Not Found

We could not find what you were looking for.

Please contact the owner of the site that linked you to the original URL and let them know their link is broken.

1 Like

This is great. I was wondering whether Rapier could provide a joint that is constrained to move only within a specific plane, with settings such as a motor, target velocity, and force limit.

The existing 6DOF joint can approximate this by locking one axis and enabling motors on the other two axes. However, the key issue is that when moving diagonally, the combined force produced by the motors on the two axes becomes greater. This is rather undesirable for simulating a physical character standing on an inclined platform, because it means the character can remain stationary at some orientations while turning, but at other orientations the motors don’t have enough force to keep them stationary.

1 Like