Return zero rotation vector when converting neutral quaternion

Previously it would return nans
This commit is contained in:
Oleg Kalachev 2025-07-01 02:48:49 +03:00
parent 9229b743eb
commit 48c7135efb

View File

@ -84,6 +84,7 @@ public:
} }
Vector toRotationVector() const { Vector toRotationVector() const {
if (w == 1 && x == 0 && y == 0 && z == 0) return Vector(0, 0, 0); // neutral quaternion
float angle; float angle;
Vector axis; Vector axis;
toAxisAngle(axis, angle); toAxisAngle(axis, angle);