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

Filter collisions between children of the same rigidbody in broad phase #241

Merged

Conversation

mbrea-c
Copy link
Contributor

@mbrea-c mbrea-c commented Nov 12, 2023

Objective

Currently, collisions between multiple child colliders of the same rigidbody are ignored by the solver. However:

  • Collision events are generated for such cases.
  • All such collisions are processed in the narrow phase, which has a large performance impact in projects that rely heavily on child colliders.

Preferably all such collisions should be filtered out earlier, in the broad phase, to avoid both of these issues.

Solution

  • Keep the ColliderParent of a collider in AabbIntervals in the broad phase.
  • Ignore a collision if the ColliderParent of two entities is equal.

Changelog

  • Collisions between children of the same rigidbody are no longer reported in contact events and are no longer processed in the narrow phase.

@Jondolf Jondolf added C-Enhancement New feature or request C-Performance Improvements or questions related to performance A-Collision Relates to the broad phase, narrow phase, colliders, or other collision functionality labels Nov 12, 2023
Copy link
Owner

@Jondolf Jondolf left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@Jondolf Jondolf merged commit 6444910 into Jondolf:main Nov 12, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Collision Relates to the broad phase, narrow phase, colliders, or other collision functionality C-Enhancement New feature or request C-Performance Improvements or questions related to performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants