From 241e767ab6eca0558679f59ba9c37b056346bc0a Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Thu, 30 Jul 2015 18:44:09 -0700 Subject: [PATCH] move setHandPosition from SkeletonModel to AvatarRig. Tell Rig::initJointStates joint-indexes for hands and elbows and shoulders --- libraries/animation/src/AvatarRig.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libraries/animation/src/AvatarRig.cpp b/libraries/animation/src/AvatarRig.cpp index 73ac793c80..97fbb82944 100644 --- a/libraries/animation/src/AvatarRig.cpp +++ b/libraries/animation/src/AvatarRig.cpp @@ -20,13 +20,14 @@ void AvatarRig::updateJointState(int index, glm::mat4 parentTransform) { const FBXJoint& joint = state.getFBXJoint(); // compute model transforms - int parentIndex = joint.parentIndex; - if (parentIndex == -1) { + if (index == _rootJointIndex) { + // we always zero-out the translation part of an avatar's root join-transform. state.computeTransform(parentTransform); clearJointTransformTranslation(index); } else { // guard against out-of-bounds access to _jointStates - if (joint.parentIndex >= 0 && joint.parentIndex < _jointStates.size()) { + int parentIndex = joint.parentIndex; + if (parentIndex >= 0 && parentIndex < _jointStates.size()) { const JointState& parentState = _jointStates.at(parentIndex); state.computeTransform(parentState.getTransform(), parentState.getTransformChanged()); }