Description
Currently, there is no "quick" way to customize gravity of the default rapier context, users are force to either opt out of default context, or add a setup system to change the gravity after its creation, which makes up a surprising API.
Solution discussion
Adapt InitializeDefaultRapierContext
Add a RapierConfiguration
field to RapierContextInitialization::InitializeDefaultRapierContext
. That's problematic because gravity depends on IntegrationParameters::length_unit
.
Gravity in length unit ?
Should gravity by multiplied by IntegrationParameters::length_unit
? Currently it’s a bit counter intuitive to pass gravity on a “physics” scale, bevy_rapier multiplies it during initialization, which creates an annoying dependency. (https://github.com/Vrixyz/bevy_rapier/blob/c11fd657452ad41070fb07e961e479132da5f470/src/plugin/plugin.rs#L413)
I believe this makes the most sense, but will mess up with users gravity without clear indicators (changelog should be super clear !)
Pass a callback ?
Customize the rapierconfiguration when it's created, through a callback passing the entity/rapiercontext or World
.
That's the less invasive change.