bevy
bevy copied to clipboard
fix: Possible NaN due to denormalised quaternions in AABB implementations for round shapes.
Objective
With an unlucky denormalised quaternion (or just a regular very denormalised quaternion), it's possible to obtain NaN values for AABB's in shapes which rely on an AABB for a disk.
Solution
Add an additional .max(Vec3::ZERO)
clamp to get rid of negative values arising due to numerical errors.
Fixup some unnecessary calculations and improve variable names in relevant code, aiming for consistency.
Discussion
These two (nontrivial) lines of code are repeated at least 5 times, maybe they could be their own method.