dimforge / bevy_rapier

Official Rapier plugin for the Bevy game engine.
https://rapier.rs
Apache License 2.0
1.22k stars 259 forks source link

Adding Sensor Component only works for Dynamic Rigid Bodies #469

Open jakelacey2012 opened 9 months ago

jakelacey2012 commented 9 months ago

Sensor colliders on the other end don't generate contacts: they only generate intersection events when one sensor collider and another collider start/stop touching. Sensor colliders are generally used to detect when something enters an area.

https://rapier.rs/docs/user_guides/bevy_plugin/colliders

This sentence is misleading, it suggests that I can simply just add the Sensor component and I the entity will not be collidable. However this will only be the case if the entity also contains a ridgid body component.

Screenshot 2023-11-19 at 20 45 49

The squares around this player are child components that are made up like this.

builder
   .spawn((
      Sensor {},
      Collider::cuboid(10., 10.),
      Transform::from_xyz(20., 0., 0.),
    ));

These should not be collidable, but they are - they are only Sensor components when the parent entity is a dynamic component. I might be missing something here though :)

Screenshot 2023-11-19 at 20 48 35
sebcrozet commented 7 months ago

Interesting, that looks like a bug in bevy_rapier. I’ll transfer the issue to its repo.