Skip to content

Prune manifolds without points#879

Merged
Jondolf merged 2 commits into
avianphysics:mainfrom
kristoff3r:prune-contacts
Oct 31, 2025
Merged

Prune manifolds without points#879
Jondolf merged 2 commits into
avianphysics:mainfrom
kristoff3r:prune-contacts

Conversation

@kristoff3r

Copy link
Copy Markdown
Contributor

Objective

Based on the doc comments for ContactManifold and the example character controller, it seems like an invariant that they should always have at least 1 point. In my project with a slightly modified version of the example 3d kinematic controller this was sometimes violated when standing still in certain spots with slightly rugged terrain. In the kinematic_controller_collisions function this leads to deepest_penetration being set to Scalar::MIN, leading to inf/NaN in LinearVelocity which then spreads throughout the system.

Solution

Prune manifolds with no points after pruning the points.

Testing

I can no longer get my project to crash with this PR, before I could easily trigger it within 20 seconds

@Jondolf Jondolf added C-Bug Something isn't working A-Collision Relates to the broad phase, narrow phase, colliders, or other collision functionality D-Straightforward Simple bug fixes and API improvements, docs, test and examples labels Oct 29, 2025

@Jondolf Jondolf left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, looks correct!

@Jondolf Jondolf added this to the 0.4.1 milestone Oct 31, 2025
@Jondolf Jondolf merged commit 8f4ab6c into avianphysics:main Oct 31, 2025
6 checks passed
@kristoff3r kristoff3r deleted the prune-contacts branch October 31, 2025 22:27
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 D-Straightforward Simple bug fixes and API improvements, docs, test and examples

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants