Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customizing Gravity (and RapierConfiguration) is not ergonomic #633

Open
Vrixyz opened this issue Feb 4, 2025 · 0 comments
Open

Customizing Gravity (and RapierConfiguration) is not ergonomic #633

Vrixyz opened this issue Feb 4, 2025 · 0 comments

Comments

@Vrixyz
Copy link
Contributor

Vrixyz commented Feb 4, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant