Skip to content

Commit

Permalink
Better rotation matrix identity check. (#180)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #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
  • Loading branch information
cdtwigg authored and facebook-github-bot committed Jan 7, 2025
1 parent 8859b1a commit 9282fb2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion momentum/io/gltf/gltf_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,8 @@ void addSkeletonStatesToModel(

auto localR = skeletonStates[i].jointState[j].localRotation().cast<float>();
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;
}
Expand Down

0 comments on commit 9282fb2

Please sign in to comment.