dimforge / dimforge/bevy_rapier

`RapierPhysicsPlugin` requires generics

Open
#501 1 comment 0 reactions 0 assignees View on GitHub
A-Integration C-Enhancement D-Difficult P-Low S-not-started
Dominant language
Rust
Stars
1.6k
Forks
282
PR merge metrics
No merged PRs in 30d

Description

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

```rust
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:

```rust
RapierPhysicsPlugin::<()>::default()
```

or:

```rust
RapierPhysicsPlugin::::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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.