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

RapierPhysicsPlugin requires generics #501

Open
Jondolf opened this issue May 9, 2024 · 1 comment
Open

RapierPhysicsPlugin requires generics #501

Jondolf opened this issue May 9, 2024 · 1 comment
Labels
A-Integration very bevy specific C-Enhancement New feature or request D-Difficult Needs strong technical background, domain knowledge, or impacts are high, needs testing... P-Low S-not-started Work has not started

Comments

@Jondolf
Copy link

Jondolf commented May 9, 2024

Trying to add the plugin the way that most Bevy plugins are added fails:

fn main() {
    App::new()
        .add_plugins((DefaultPlugins, RapierPhysicsPlugin::default()))
        .run();
}

It fails because Rust cannot infer the type for PhysicsHooks. Instead, you need to do something like this:

RapierPhysicsPlugin::<()>::default()

or:

RapierPhysicsPlugin::<NoUserData>::default()

This isn't obvious for new users, and is especially confusing because the plugin has no documentation example (outside the website's general usage guides). The use of NoUserData or the concept of physics hooks isn't even explained on the website before the "Advanced collision-detection" section, even though the plugin initialization is essentially the first thing that a user has to do. It shouldn't be necessary to use generics here.

Additionally, limiting the user to a single PhysicsHooks type feels rather limiting and annoying from a composability standpoint. But that's another issue.

@Vrixyz Vrixyz added D-Difficult Needs strong technical background, domain knowledge, or impacts are high, needs testing... P-Medium S-not-started Work has not started A-Integration very bevy specific labels May 21, 2024
@Vrixyz
Copy link
Contributor

Vrixyz commented May 21, 2024

I'm not too familiar with this part of the code, but I agree with the struggle.

@Vrixyz Vrixyz added P-High arbitrary important item P-Low and removed P-Medium P-High arbitrary important item labels May 21, 2024
@Vrixyz Vrixyz added the C-Enhancement New feature or request label May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Integration very bevy specific C-Enhancement New feature or request D-Difficult Needs strong technical background, domain knowledge, or impacts are high, needs testing... P-Low S-not-started Work has not started
Projects
None yet
Development

No branches or pull requests

2 participants