Showing the changes to interface/src/avatar/SkeletonModel.cpp (1 of 1 file). Show all
Unified · Split
| @@ -137,15 +137,14 @@ void SkeletonModel::updateRig(float deltaTime, glm::mat4 parentTransform) { · 136 unmodified lines | |||
| 137 | // If the head is not positioned, updateEyeJoints won't get the math right | 137 | // If the head is not positioned, updateEyeJoints won't get the math right |
| 138 | glm::quat headOrientation; | 138 | glm::quat headOrientation; |
| 139 | _rig->getJointRotation(geometry.headJointIndex, headOrientation); | 139 | _rig->getJointRotation(geometry.headJointIndex, headOrientation); |
| 140 | glm::quat modelOrientation = getRotation(); | 140 | glm::vec3 eulers = safeEulerAngles(headOrientation); |
| 141 | glm::quat adjust = modelOrientation; | ||
| 142 | glm::quat headOrientationInAvatar = adjust * headOrientation; | ||
| 143 | glm::vec3 eulers = safeEulerAngles(headOrientationInAvatar); | ||
| 144 | head->setBasePitch(glm::degrees(-eulers.x)); | 141 | head->setBasePitch(glm::degrees(-eulers.x)); |
| 142 | head->setBaseYaw(glm::degrees(eulers.y)); | ||
| 143 | head->setBaseRoll(glm::degrees(-eulers.z)); | ||
| 145 | _rig->updateEyeJoints(geometry.leftEyeJointIndex, geometry.rightEyeJointIndex, | 144 | _rig->updateEyeJoints(geometry.leftEyeJointIndex, geometry.rightEyeJointIndex, |
| 146 | getTranslation(), modelOrientation, | 145 | getTranslation(), getRotation(), |
| 147 | head->getFinalOrientationInWorldFrame(), head->getCorrectedLookAtPosition()); | 146 | head->getFinalOrientationInWorldFrame(), head->getCorrectedLookAtPosition()); |
| 148 | } | 147 | } |
| 149 | } | 148 | } |
| 150 | 149 | ||
| 151 | // Called by Avatar::simulate after it has set the joint states (fullUpdate true if changed), | 150 | // Called by Avatar::simulate after it has set the joint states (fullUpdate true if changed), |