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

Expand AABBs only in the movement direction #83

Merged
merged 1 commit into from
Jul 17, 2023
Merged

Conversation

Jondolf
Copy link
Owner

@Jondolf Jondolf commented Jul 17, 2023

Previously, AABBs were expanded equally in all directions based on the velocity of the body in order to avoid missing potential collisions during the broad phase. However, expanding the AABBs in the direction opposite of the movement direction is unnecessary.

This PR changes it so that AABBs are only expanded in the direction of the linear velocity. The angular velocity still expands AABBs in all directions regardless of the shape, but that can maybe be addressed in another PR.

This is how AABBs look now: (gizmos have a delay, so it can often look like the AABBs are still expanded behind the bodies; this is not actually the case)

2023-07-17.23-19-42.mp4

This also gives a significant performance boost for situations with many colliders close to each other. For example, previously 1040 moving marbles gave 10 FPS, but now it's a stable 60 FPS.

@Jondolf Jondolf added C-Enhancement New feature or request A-Collision Relates to the broad phase, narrow phase, colliders, or other collision functionality C-Performance Improvements or questions related to performance labels Jul 17, 2023
@Jondolf Jondolf merged commit 9ea9656 into main Jul 17, 2023
@Jondolf Jondolf deleted the aabb-expand-direction branch July 17, 2023 21:12
DanielHZhang pushed a commit to DanielHZhang/bevy_xpbd that referenced this pull request Oct 9, 2023
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.

1 participant