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

Use swept AABBs for collider AABBs #188

Merged
merged 3 commits into from
Oct 19, 2023
Merged

Use swept AABBs for collider AABBs #188

merged 3 commits into from
Oct 19, 2023

Conversation

Jondolf
Copy link
Owner

@Jondolf Jondolf commented Oct 19, 2023

Objective

Collider AABBs are expanded based on the velocities of bodies. This is only done in the direction of linear velocity, but for angular velocity, AABBs are expanded uniformly in all directions. This means that e.g. rotating balls will unnecessarily have their AABBs expanded, which leads to extra overlaps.

Solution

Use compute_swept_aabb instead of compute_aabb for computing the AABBs. The end position of the sweep is predicted using the linear and angular velocity. It takes the shape into account, so e.g. rotating balls won't be expanded, but long rotating planks will.

Instead of always adding a uniform padding that scales with angular velocity,
it now uses swept AABBs with the end position predicted based on the velocity.
This way, the shape affects the padding, so e.g. rotating balls aren't expanded.
@Jondolf Jondolf added C-Enhancement New feature or request A-Collision Relates to the broad phase, narrow phase, colliders, or other collision functionality labels Oct 19, 2023
@Jondolf Jondolf merged commit a598753 into main Oct 19, 2023
@Jondolf Jondolf deleted the swept-aabbs branch October 19, 2023 10:03
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant