From a2ce57ade32e2f3de5f4c3b275ec26e973e2ed59 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Sat, 13 Jun 2020 14:47:14 -0700 Subject: [PATCH] Fir applyAnimation() when scale is close or equal to 0 --- libs/gltfio/src/math.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libs/gltfio/src/math.h b/libs/gltfio/src/math.h index 2f5beed281..caa4782431 100644 --- a/libs/gltfio/src/math.h +++ b/libs/gltfio/src/math.h @@ -75,10 +75,12 @@ inline void decomposeMatrix(const filament::math::mat4f& mat, filament::math::fl clone[0] /= s.x; clone[1] /= s.y; clone[2] /= s.z; + // Extract rotation + *rotation = clone.toQuaternion(); + } else { + // Set to identity if close to zero + *rotation = quatf(1); } - - // Extract rotation. - *rotation = clone.toQuaternion(); } inline filament::math::mat4f composeMatrix(const filament::math::float3& translation,