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

Disable overlap warning for sensors #468

Closed

Conversation

hocop
Copy link
Contributor

@hocop hocop commented Jul 23, 2024

Objective

There is a warning that looks like this:

WARN avian2d::collision::narrow_phase: Entity { index: 8, generation: 1 } and Entity { index: 20, generation: 1 } are overlapping at spawn, which can result in explosive behavior.

In my opinion it shouldn't show up when we are spawning Sensors. They may overlap without explosive behavior.

Solution

Sensors are filtered out from the log_overlap_at_spawn system

@@ -689,7 +689,7 @@ impl<'w, 's, C: AnyCollider> NarrowPhase<'w, 's, C> {
#[cfg(debug_assertions)]
fn log_overlap_at_spawn(
collisions: Res<Collisions>,
added_bodies: Query<(Ref<RigidBody>, Option<&Name>, &Position)>,
added_bodies: Query<(Ref<RigidBody>, Option<&Name>, &Position), Without<Sensor>>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm? Wouldn't the Sensor usually be part of a Collider, which may or may not coincide with being a RigidBody?
I guess this change helps with the case where the RigidBody is holding both the Collider and the Sensor, but does not help with a RigidBody that is the ancestor of a Collider with a Sensor.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. I thought for some reason that you have to have RigidBody in order for all colliders to work. But now I see that I don't need it and it works without warnings.

Thanks for you comment!

@hocop hocop closed this Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants