dimforge / parry

2D and 3D collision-detection library for Rust.
https://parry.rs
Apache License 2.0
528 stars 93 forks source link

QbvhUpdateWorkspace stack depth change u8 to u16 to prevent overflow #169

Closed honnisha closed 3 months ago

honnisha commented 8 months ago

QbvhUpdateWorkspace stack depth can be more than 255, so I changed u8 to u16.

After this change, I no longer received the error: attempt to add with overflow on the line: workspace.stack.push((child, depth + 1));

Related error: https://github.com/dimforge/rapier/issues/532

axelmagn commented 3 months ago

bump on this? I think it would fix #146, and no discussion for half a year. I just wrote a similar patch before seeing that there's already an open PR.

sebcrozet commented 3 months ago

Unfortunately, this is not a valid fix. The problem here is that the incremental update tends to make the tree more progressively more degenerate (increasingly deep). Changing the depth type only hides the actual problem. A fix here needs to rework the way rebalancing is implemented.