jcornaz / heron

[DISCONTINUED] An ergonomic physics API for bevy games
MIT License
293 stars 44 forks source link

Collision events for sensor always firing, PhysicsLayer issue or incorrect setup?? #316

Open Hellzbellz123 opened 2 years ago

Hellzbellz123 commented 2 years ago

i have 4 physics layers in my app, the entitys that can collide have collision layers like below, the player, and the enemys have collision shapes on child entitys, im not sure if its because i have the physics layers organized wrong or if i have some other thing shooting me in the foot, but ive tried quite a few different combos of groups/masks/layers to no real effect. i also noticed that no matter what i do my players/enemys always collide, even when both have CollisionLayers::none() or i mask them out

i took the collision detection event system from the examples to test the sensor and i noticed that my player and skeleton entitys have an obscenely large amount of groups/masks

heres the output from an event reader for collisionevent

Collision started between CollisionData { rigid_body_entity: 2729v0, collision_shape_entity: 2729v0, collision_layers: CollisionLayers { groups: 8, masks: 2 }, normals: [] } and CollisionData { rigid_body_entity: 2812v0, collision_shape_entity: 2813v0, collision_layers: CollisionLayers { groups: 4294967295, masks: 4294967295 }, normals: [] }
Collision stopped between CollisionData { rigid_body_entity: 2729v0, collision_shape_entity: 2729v0, collision_layers: CollisionLayers { groups: 8, masks: 2 }, normals: [] } and CollisionData { rigid_body_entity: 2812v0, collision_shape_entity: 2813v0, collision_layers: CollisionLayers { groups: 4294967295, masks: 4294967295 }, normals: [] }

im marking my Sensor entity with :

collision_layers: CollisionLayers::none()
                    .with_group(PhysicsLayers::Sensor)
                    .with_mask(PhysicsLayers::Player)

im marking my walls with:

collision_layers: CollisionLayers::none()
                    .with_group(PhysicsLayers::World)
                    .with_masks(&[PhysicsLayers::Player, PhysicsLayers::Enemies])

im spawning my player with:

collisionlayers: CollisionLayers::none()
                    .with_group(PhysicsLayers::Player)

and im marking my enemies with

collisionlayers: CollisionLayers::none()
                                .with_group(PhysicsLayers::Enemies)

physicslayers is my enum for things that can collide

#[derive(PhysicsLayer)]
pub enum PhysicsLayers {
    Sensor,
    World,
    Player,
    Enemies,
}
Hellzbellz123 commented 2 years ago

the actual repo is located here: https://github.com/Hellzbellz123/VanillaCoffee, if any more information would be helpful let me know, im pretty stumped atm, gonna attack it after some sleep

jcornaz commented 2 years ago

Thanks for the report. It does look like a bug to me.

Sadly, today I decided to discontinue the project. Therefore, I won't investigate this issue myself. But I'll gladly accept a fix, if someone were to provide one.

By the way, this is one of those difficult times i mention in my discontinuation announcement, where it is not clear which is the culprit, heron or rapier? I have a quite good test suite for the layer interactions, so that bug is quite a surprise.