bevy_rapier
bevy_rapier copied to clipboard
CollidingEntities component, doesnt seen to work with sensors.
Hello, so this specific component. Is broken
https://docs.rs/bevy_rapier3d/latest/bevy_rapier3d/geometry/struct.CollidingEntities.html
Doesnt seen to be working as expected . As you can see in the video below Gravação de tela de 21-06-2024 14:42:43.webm
The function collision event is detecting correctly the collisions among sensors. But for some unknown reason it doesn't "fill up" the CollidingEntities component.
Sample codes:
fn display_events(
mut collision_events: EventReader<CollisionEvent>,
mut contact_force_events: EventReader<ContactForceEvent>,
) {
for collision_event in collision_events.read() {
println!("Received collision event: {:?}", collision_event);
}
for contact_force_event in contact_force_events.read() {
println!("Received contact force event: {:?}", contact_force_event);
}
}
pub fn detect_hits(
colliding: Query<&CollidingEntities>,
){
for p in colliding.iter(){
for i in p.iter(){
println!("{:?}",i);
}
}
}
Did you add the ColllidingEntities component manually to the Player? Because I just switched from avian to rapier, and I found out that avian automatically add ColllidingEntities for you, but in rapier you need to add the component by yourself.
Yeah I did still broken, it just doenst detect any entity whatsoever
I stumbled upon this issue too, but turns out CollidingEntities does work with sensors. In my case, I was trying to get collisions with my kinematic character controller, and for kinematic bodies you should set ActiveCollisionTypes ! e.g.
app.register_required_components::<Sensor, CollidingEntities>()
.register_required_components_with::<Sensor, _>(|| ActiveEvents::COLLISION_EVENTS)
.register_required_components_with::<Sensor, _>(|| {
ActiveCollisionTypes::default()
| ActiveCollisionTypes::KINEMATIC_STATIC
| ActiveCollisionTypes::KINEMATIC_KINEMATIC
});