Adding Rapier as a physics backend

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By looooooooong

I’m considering adding Rapier as a physics backend for Godot. From the source code, I recognize that I have to implement the classes that inherit PhysicsServer3D and PhysicsServer2D, then register these classes using PhysicsServer3DManager and PhysicsServer2DManager. Is it possible to write the physics backend using Rust and GDNative, or do I have to modify Godot source code to include the new physics backend?

:bust_in_silhouette: Reply From: Ertain

From what I’ve seen, someone has already tried using Rapier in the engine.

It looks like GDNative is treated like a library that can be loaded by the engine. Since the Rust bindings for the engine are mature (at least, that’s what I’ve read; your mileage will probably vary), it should be possible to use Rapier as a physics backend, and it will be unnecessary to edit the main source code of the engine.

I checked that repository. It’s not really a true integration. What I’m going to do is to write a phyiscs backend that can be switched to in the Project Setting, like Bullet Physics and Godot Physics.

looooooooong | 2021-05-14 21:52

If that work has already been done, doing the final integration would likely be easier.

I think this would be very helpful as there are multiple bugs related to the physics engine at the moment.

tavurth | 2021-05-16 07:02