MCPcopy Index your code
hub / github.com/appsinacup/godot-rapier-physics

github.com/appsinacup/godot-rapier-physics @v0.8.38

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.8.38 ↗ · + Follow
1,830 symbols 4,577 edges 91 files 96 documented · 5%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Works on: Desktop, Mobile and Web

    <img src="https://github.com/appsinacup/godot-rapier-physics/actions/workflows/runner.yml/badge.svg?branch=main"
        alt="Godot Rapier Build"></a>
    <img src="https://img.shields.io/badge/Godot-4.7-%23478cbf?logo=godot-engine&logoColor=white" />








<strong>
    <a href="https://godot.rapier.rs">Documentation</a> | <a href="https://github.com/appsinacup/godot-rapier-physics/blob/main/CHANGELOG.md">Changelog</a> | <a href="https://discord.gg/v649emcpAu">Discord</a> | <a href="https://github.com/appsinacup/godot-rapier-physics/blob/main/CONTRIBUTING.md">Contributing</a> | <a href="https://github.com/appsinacup/godot-rapier-physics/blob/main/ARCHITECTURE.md">Architecture</a>
</strong>

2D and 3D physics engine for the Godot game engine. with better stability, performance, liquids, determinism, state serialization and no ghost collisions.


Godot Rapier Physics is a 2D and 3D physics drop-in replacement for the Godot game engine through rapier physics engine salva fluids simulation library.

Features

Stability No Vibrations
Fluids 2D Fluids 3D
Body Skin Inverse Kinematics
No Ghost Collisions Improved Stacking
Serialization Deserialization
Save Physics State Load Physics State
Locally Deterministic *Optionally Cross Platform Deterministic
Exact simulation every time (on same platform) Exact simulation on multiple platforms

Installation

After installing, go to Advanced Settings -> Physics -> 2D or 3D. Change Physics Engine to Rapier2D or Rapier3D.

Rust dependency

See godot-rust/ExtensionLibrary.

[dependencies]
godot-rapier = { git = "https://github.com/appsinacup/godot-rapier-physics.git", tag = "v0.8.38", features = ["single-dim2"] }

Feature sets matching the shipped addon variants:

Variant Features
2D fast parallel single-dim2, serde-serialize, simd-stable, parallel, experimental-threads, register-docs, api-4-7
3D fast parallel single-dim3, serde-serialize, simd-stable, parallel, experimental-threads, register-docs, api-4-7
2D enhanced deterministic single-dim2, serde-serialize, enhanced-determinism, experimental-threads, register-docs, api-4-7
3D enhanced deterministic single-dim3, serde-serialize, enhanced-determinism, experimental-threads, register-docs, api-4-7

Use exactly one Godot API feature: api-4-4, api-4-5, api-4-6, or api-4-7.

For web/Emscripten builds, replace native experimental-threads with one web feature: experimental-wasm for threaded web builds, or experimental-wasm-nothreads for no-thread web builds. experimental-wasm-nothreads includes experimental-wasm. CI builds web with wasm32-unknown-emscripten, release-wasm, and -Zbuild-std.

When depending on another GDExtension crate, set GDRUST_MAIN_EXTENSION to your extension's ExtensionLibrary type and explicitly forward Godot Rapier's init stages from your extension. Godot only runs one main ExtensionLibrary, so the user's extension must register the Rapier server and classes too:

use godot::prelude::*;
use godot_rapier::RapierPhysics3DExtensionLibrary;

struct MyExtension;

#[gdextension]
unsafe impl ExtensionLibrary for MyExtension {
    fn min_level() -> InitLevel {
        InitLevel::Servers
    }

    fn on_stage_init(level: InitStage) {
        RapierPhysics3DExtensionLibrary::on_stage_init(level);
    }

    fn on_stage_deinit(level: InitStage) {
        RapierPhysics3DExtensionLibrary::on_stage_deinit(level);
    }
}

For 2D projects, use RapierPhysics2DExtensionLibrary.

Do not load the standalone Godot Rapier addon in the same Godot project when bundling it through another Rust GDExtension, because Godot classes can be registered twice.

Youtube Videos

GamesFromScratch:

IMAGE ALT TEXT HERE

Showcase

Got a game or app you built with this addon? We showcase them on godot.rapier.rs/showcase. Submit your entry here.

Implementation Progress

The 2D part is pretty stable, though there are some issues, the 3D part is still missing some things. See the Implementation Progress to get an idea of what status it is in and what features it has.

Limitations

  • Double builds need to be manually built.
  • No support for asymmetric collisions (eg. object 1 hitting object 2 but object 2 not hitting object 1). This is the exact check rapier does: (A.layer & B.mask) != 0 || (B.layer & A.mask) != 0

Module build

In order to build it as a module, go to: - Godot Rapier Physics Module 2D - Godot Rapier Physics Module 3D

Star History

Star History Chart

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Shape

Method 1,538
Function 142
Class 129
Enum 15
Interface 6

Languages

Rust100%

Modules by API surface

src/servers/rapier_physics_server_3d.rs198 symbols
src/servers/rapier_physics_server_impl.rs180 symbols
src/servers/rapier_physics_server_2d.rs142 symbols
src/bodies/rapier_body.rs135 symbols
src/bodies/rapier_area.rs80 symbols
src/spaces/rapier_space_state.rs63 symbols
src/spaces/rapier_space_body_helper.rs59 symbols
src/bodies/rapier_direct_body_state_3d.rs54 symbols
src/bodies/rapier_collision_object_base.rs53 symbols
src/bodies/rapier_direct_body_state_impl.rs52 symbols
src/bodies/rapier_direct_body_state_2d.rs52 symbols
src/rapier_wrapper/physics_world.rs46 symbols

For agents

$ claude mcp add godot-rapier-physics \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page