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

Default values for friction, restitution and damping should be globally configurable #119

Open
Jondolf opened this issue Aug 9, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@Jondolf
Copy link
Owner

Jondolf commented Aug 9, 2023

We should make it possible to configure the default values used for friction and restitution. It's annoying to set each body's friction separately if your world is full of ice, for example.

While we can't change the value returned by e.g. Restitution::default() at runtime, it should be very straightforward to do in the PreparePlugin when initializing missing components for bodies and colliders. We can store the default values in resources and use them for the default values of the components.

Naming

How do we want to name the resources? Do we want each component to have a separate resource, or should we group properties together?

Here are a few ideas:

// All separate
struct DefaultFriction(Friction);
struct DefaultRestitution(Restitution);
struct DefaultLinearDamping(Scalar);
struct DefaultAngularDamping(Scalar);

// Grouped
struct DefaultMaterialProperties {
    friction: Friction,
    restitution: Restitution,
}
struct DefaultDamping {
    linear: Scalar,
    angular: Scalar,
}

// All together
struct DefaultPhysicsProperties {
    friction: Friction,
    restitution: Restitution,
    linear_damping: Scalar,
    angular_damping: Scalar,
}

The Default could also be replaced by Global or World, whichever one is more clear.

Personally, I prefer the first option of using separate resources, since it's a bit more explicit and consistent in terms of our naming conventions, but if others have different ideas, feel free to share.

@Jondolf Jondolf added the enhancement New feature or request label Aug 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant