diff --git a/interface/src/avatar/SkeletonModel.cpp b/interface/src/avatar/SkeletonModel.cpp index 1290cfd53f..e975fc2d78 100644 --- a/interface/src/avatar/SkeletonModel.cpp +++ b/interface/src/avatar/SkeletonModel.cpp @@ -69,7 +69,7 @@ void SkeletonModel::simulate(float deltaTime, bool fullUpdate) { int jointIndex = geometry.humanIKJointIndices.at(humanIKJointIndex); if (jointIndex != -1) { JointState& state = _jointStates[jointIndex]; - state.setRotationFromBindFrame(prioVR->getJointRotations().at(i), PALM_PRIORITY); + state.setRotationInBindFrame(prioVR->getJointRotations().at(i), PALM_PRIORITY); } } return; @@ -217,7 +217,7 @@ void SkeletonModel::applyPalmData(int jointIndex, PalmData& palm) { setJointPosition(parentJointIndex, palmPosition + forearm, glm::quat(), false, -1, false, glm::vec3(0.0f, -1.0f, 0.0f), PALM_PRIORITY); JointState& parentState = _jointStates[parentJointIndex]; - parentState.setRotationFromBindFrame(palmRotation, PALM_PRIORITY); + parentState.setRotationInBindFrame(palmRotation, PALM_PRIORITY); // lock hand to forearm by slamming its rotation (in parent-frame) to identity _jointStates[jointIndex].setRotationInConstrainedFrame(glm::quat()); } else { @@ -381,13 +381,13 @@ void SkeletonModel::setHandPosition(int jointIndex, const glm::vec3& position, c glm::quat shoulderRotation = rotationBetween(forwardVector, elbowPosition - shoulderPosition); JointState& shoulderState = _jointStates[shoulderJointIndex]; - shoulderState.setRotationFromBindFrame(shoulderRotation, PALM_PRIORITY); + shoulderState.setRotationInBindFrame(shoulderRotation, PALM_PRIORITY); JointState& elbowState = _jointStates[elbowJointIndex]; - elbowState.setRotationFromBindFrame(rotationBetween(shoulderRotation * forwardVector, wristPosition - elbowPosition) * shoulderRotation, PALM_PRIORITY); + elbowState.setRotationInBindFrame(rotationBetween(shoulderRotation * forwardVector, wristPosition - elbowPosition) * shoulderRotation, PALM_PRIORITY); JointState& handState = _jointStates[jointIndex]; - handState.setRotationFromBindFrame(rotation, PALM_PRIORITY); + handState.setRotationInBindFrame(rotation, PALM_PRIORITY); } bool SkeletonModel::getLeftHandPosition(glm::vec3& position) const { diff --git a/interface/src/renderer/JointState.cpp b/interface/src/renderer/JointState.cpp index 22473d4d39..bcf7d724ba 100644 --- a/interface/src/renderer/JointState.cpp +++ b/interface/src/renderer/JointState.cpp @@ -95,7 +95,7 @@ void JointState::computeVisibleTransform(const glm::mat4& parentTransform) { _visibleRotation = extractRotation(_visibleTransform); } -glm::quat JointState::getRotationFromBindToModelFrame() const { +glm::quat JointState::getRotationInBindFrame() const { return _rotation * _fbxJoint->inverseBindRotation; } @@ -107,7 +107,7 @@ void JointState::restoreRotation(float fraction, float priority) { } } -void JointState::setRotationFromBindFrame(const glm::quat& rotation, float priority, bool constrain) { +void JointState::setRotationInBindFrame(const glm::quat& rotation, float priority, bool constrain) { // rotation is from bind- to model-frame assert(_fbxJoint != NULL); if (priority >= _animationPriority) { diff --git a/interface/src/renderer/JointState.h b/interface/src/renderer/JointState.h index c0b08d2cff..99cf14bf3a 100644 --- a/interface/src/renderer/JointState.h +++ b/interface/src/renderer/JointState.h @@ -46,7 +46,7 @@ public: glm::vec3 getPosition() const { return extractTranslation(_transform); } /// \return rotation from bind to model frame - glm::quat getRotationFromBindToModelFrame() const; + glm::quat getRotationInBindFrame() const; int getParentIndex() const { return _fbxJoint->parentIndex; } @@ -72,7 +72,7 @@ public: /// \param rotation is from bind- to model-frame /// computes and sets new _rotationInConstrainedFrame /// NOTE: the JointState's model-frame transform/rotation are NOT updated! - void setRotationFromBindFrame(const glm::quat& rotation, float priority, bool constrain = false); + void setRotationInBindFrame(const glm::quat& rotation, float priority, bool constrain = false); void setRotationInConstrainedFrame(const glm::quat& targetRotation); void setVisibleRotationInConstrainedFrame(const glm::quat& targetRotation); diff --git a/interface/src/renderer/Model.cpp b/interface/src/renderer/Model.cpp index 6394cd8c29..d65cb014c9 100644 --- a/interface/src/renderer/Model.cpp +++ b/interface/src/renderer/Model.cpp @@ -1041,8 +1041,8 @@ bool Model::setJointPosition(int jointIndex, const glm::vec3& position, const gl if (useRotation) { JointState& state = _jointStates[jointIndex]; - state.setRotationFromBindFrame(rotation, priority); - endRotation = state.getRotationFromBindToModelFrame(); + state.setRotationInBindFrame(rotation, priority); + endRotation = state.getRotationInBindFrame(); } // then, we go from the joint upwards, rotating the end as close as possible to the target @@ -1213,7 +1213,7 @@ void Model::inverseKinematics(int endIndex, glm::vec3 targetPosition, const glm: } while (numIterations < MAX_ITERATION_COUNT && distanceToGo < ACCEPTABLE_IK_ERROR); // set final rotation of the end joint - endState.setRotationFromBindFrame(targetRotation, priority, true); + endState.setRotationInBindFrame(targetRotation, priority, true); _shapesAreDirty = !_shapes.isEmpty(); }