bevy icon indicating copy to clipboard operation
bevy copied to clipboard

fix: Possible NaN due to denormalised quaternions in AABB implementations for round shapes.

Open IQuick143 opened this issue 7 months ago • 0 comments

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.

IQuick143 avatar Jul 09 '24 14:07 IQuick143