A GDExtension that enables the Rapier physics engine within Godot.
It is not a drop-in replacement for the Godot physics engine. Rapier nodes operate separately from Godot physics.
- Cross platform determinism ✔️
- Physics state manual stepping ✔️
- Physics state saving & loading ✔️
- Godot 4.2.2 or later
- Download the latest --all release
- Extract the release archive into your godot project's root directory
- Add RapierRigidBody3D nodes to your scene and some RapierCollider3D + MeshInstance3D nodes as children of the rigid bodies
- Run your game
Your physics objects should simulate! 🎉
By default, the Rapier3DDebugger
autoload will start the physics simulation for you. To get more control over when you simulate, search for Rapier 3D
in your project settings and disable either Debug in Game
or Show UI
under the Debug category.
Now you can call Rapier3D.step()
from within any _physics_process()
function, or as often as you like. This function advances the physics simulation by 1 step.
func _physics_process(_delta):
Rapier3D.step()
Call Rapier3D.get_state()
anywhere in your code to get a PackedByteArray
representing the current physics state.
Use Rapier3D.set_state(snapshot)
to set the physics state to a snapshot.
Obtain a hash of a snapshot using the Rapier3D.get_hash(snapshot)
function.
var initial_snapshot
func _ready():
initial_snapshot = Rapier3D.get_state()
var hash = Rapier3D.get_hash(initial_snapshot)
func _on_button_pressed():
Rapier3D.set_state(initial_snapshot)
Confirmed via Github Actions across:
- Windows, MacOS, Linux
- arm64 / x86_64 architectures
Each release has a determinism-diffs.zip
artifact that contains determinism test results
This extension is currently under heavy development, compatibility when upgrading versions is not assured until 1.0.0
- Visualize colliders
- Snapshots & stepping
- Determinism automated testing
- Collider shapes
- Character controller
- Sensors/Areas
- Apply forces to rigidbodies
- Visualize active vs inactive bodies
- Collision layers
- Save/load snapshots to/from resource files
- Editor UI to facilitate simulating in editor
- Gizmo handles for collider shapes
- Add to Godot asset library
Currently Godot does not support on-demand physics simulation, does not have built-in snapshotting, and is also not deterministic.
These features are either important or required for creating networked games that use physics, depending on the chosen network architecture of your game.
Luckily, Godot 4 provides a great extension system and Rapier provides these missing features. 🚀
- No mobile support (godot-rust)
See CONTRIBUTING.md
- gdext discord community
- Dimforge discord community
- dsnopek and SGPhysics2D
- GameDevelopmentCenter
- appsinacup/godot-rapier-2
- ilyas-taouaou/rapier-gdext