From 9282fb24b056a1d83a86c3972e26225847c664ba Mon Sep 17 00:00:00 2001 From: Chris Twigg Date: Tue, 7 Jan 2025 09:48:05 -0800 Subject: [PATCH] Better rotation matrix identity check. (#180) Summary: Pull Request resolved: https://github.com/facebookincubator/momentum/pull/180 Matching coeffs doesn't really do what you expect for quaternions, so let's compare the rotation matrices instead. Reviewed By: yutingye, jeongseok-meta Differential Revision: D67655916 fbshipit-source-id: 0d6d6bbaf67a76dcd14c4c8bcec3a0417a80c7d3 --- momentum/io/gltf/gltf_builder.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/momentum/io/gltf/gltf_builder.cpp b/momentum/io/gltf/gltf_builder.cpp index 227254e9..423a518e 100644 --- a/momentum/io/gltf/gltf_builder.cpp +++ b/momentum/io/gltf/gltf_builder.cpp @@ -488,7 +488,8 @@ void addSkeletonStatesToModel( auto localR = skeletonStates[i].jointState[j].localRotation().cast(); rotation[j][i] = {localR.x(), localR.y(), localR.z(), localR.w()}; - if (!(localR.coeffs() - character.skeleton.joints[j].preRotation.coeffs()).isZero(1e-5f)) { + if (!(localR.toRotationMatrix() - character.skeleton.joints[j].preRotation.toRotationMatrix()) + .isZero(1e-5f)) { useChannel[j][1] = true; foundAnyChannel = true; }