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

Ignore static-static collisions in broad phase #283

Merged
merged 1 commit into from
Dec 27, 2023

Conversation

Jondolf
Copy link
Owner

@Jondolf Jondolf commented Dec 27, 2023

Objective

Currently, the broad phase determines whether a body is inactive just by checking if the position or rotation has changed. If a static body is moved, it will unnecessarily check collisions against other static bodies. This can cause performance issues with e.g. floating point worlds where all entities are frequently moved.

Solution

Also check whether the body is static in the update_aabb_intervals system.

@Jondolf Jondolf added bugfix A-Collision Relates to the broad phase, narrow phase, colliders, or other collision functionality labels Dec 27, 2023
@Jondolf Jondolf merged commit 8c00e09 into main Dec 27, 2023
4 checks passed
@Plash-har
Copy link

update_aabb_intervals should treat every collider ? Because if a collider doesn't have a RigidBody component but the parent does (and the parent doesn't possess any Collider) then this collider isn't treated by this system ?

@Jondolf
Copy link
Owner Author

Jondolf commented Dec 28, 2023

Ah this should check the ColliderParent and use that RigidBody instead, and also have the RigidBody be optional; I'll fix that

@Jondolf
Copy link
Owner Author

Jondolf commented Dec 28, 2023

Should be fixed by #285, thanks for reporting the issue. A dumb oversight on my part :P

@Jondolf Jondolf deleted the ignore-static-collisions branch December 28, 2023 11:40
Jondolf added a commit that referenced this pull request Dec 28, 2023
# Objective

#283 had an oversight where it required colliders to have a `RigidBody` for AABBs to be updated. It also didn't handle child colliders.

## Solution

Use the `ColliderParent` to get the (optional) `RigidBody` of the entity the collider is attached to.
@Jondolf Jondolf added C-Bug Something isn't working C-Performance Improvements or questions related to performance and removed bugfix labels Jul 19, 2024
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-Bug Something isn't working C-Performance Improvements or questions related to performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants