How the Godot Rapier data architecture works
mainThe plugin organizes data into two distinct layers to bridge Godot and the Rapier physics engine:
- Godot Data Layer: This layer maps directly to the data sent from Godot to the plugin. It uses a structure of stateless data and stateful data (e.g.,
RapierSpaceandRapierSpaceState). - Rapier Data Layer: This layer contains data that has been converted from the Godot format to match the requirements of the Rapier library (e.g.,
PhysicsEngine,PhysicsWorld, andPhysicsObjects).
For performance optimization, all this data is managed within a Singleton. The Singleton maintains mappings between Godot's Rid (Resource ID) and the internal plugin indices, ensuring efficient lookups across the two layers.