From 4a23c0cfd938cb1f67f97b983323e8f404ceecec Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Fri, 16 May 2014 16:25:24 -0700 Subject: [PATCH] Fix for arms' getting twisted up with new IK. --- interface/src/avatar/SkeletonModel.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/interface/src/avatar/SkeletonModel.cpp b/interface/src/avatar/SkeletonModel.cpp index 3786280a3c..09871ad38b 100644 --- a/interface/src/avatar/SkeletonModel.cpp +++ b/interface/src/avatar/SkeletonModel.cpp @@ -334,13 +334,11 @@ void SkeletonModel::setHandPosition(int jointIndex, const glm::vec3& position, c glm::vec3 forwardVector(rightHand ? -1.0f : 1.0f, 0.0f, 0.0f); - glm::quat shoulderRotation; - getJointRotation(shoulderJointIndex, shoulderRotation, true); - applyRotationDelta(shoulderJointIndex, rotationBetween(shoulderRotation * forwardVector, elbowPosition - shoulderPosition), false); + glm::quat shoulderRotation = rotationBetween(forwardVector, elbowPosition - shoulderPosition); + setJointRotation(shoulderJointIndex, shoulderRotation, true); - glm::quat elbowRotation; - getJointRotation(elbowJointIndex, elbowRotation, true); - applyRotationDelta(elbowJointIndex, rotationBetween(elbowRotation * forwardVector, wristPosition - elbowPosition), false); + setJointRotation(elbowJointIndex, rotationBetween(shoulderRotation * forwardVector, + wristPosition - elbowPosition) * shoulderRotation, true); setJointRotation(jointIndex, rotation, true); }