Showing the changes to interface/src/avatar/SkeletonModel.cpp (1 of 1 file). Show all
Unified · Split
| @@ -41,7 +41,7 @@ SkeletonModel::~SkeletonModel() { · 40 unmodified lines | |||
| 41 | 41 | ||
| 42 | void SkeletonModel::initJointStates(QVector<JointState> states) { | 42 | void SkeletonModel::initJointStates(QVector<JointState> states) { |
| 43 | const FBXGeometry& geometry = _geometry->getFBXGeometry(); | 43 | const FBXGeometry& geometry = _geometry->getFBXGeometry(); |
| 44 | glm::mat4 parentTransform = glm::scale(_scale) * glm::translate(_offset) * geometry.offset; | 44 | glm::mat4 parentTransform = glm::scale(_scale) * glm::translate(_offset) * geometry.offset/* * glm::mat4_cast(getRotation())*/; |
| 45 | 45 | ||
| 46 | int rootJointIndex = geometry.rootJointIndex; | 46 | int rootJointIndex = geometry.rootJointIndex; |
| 47 | int leftHandJointIndex = geometry.leftHandJointIndex; | 47 | int leftHandJointIndex = geometry.leftHandJointIndex; |
| @@ -123,20 +123,23 @@ void SkeletonModel::updateRig(float deltaTime, glm::mat4 parentTransform) { · 75 unmodified lines | |||
| 123 | params.rightEyeJointIndex = geometry.rightEyeJointIndex; | 123 | params.rightEyeJointIndex = geometry.rightEyeJointIndex; |
| 124 | 124 | ||
| 125 | _rig->updateFromHeadParameters(params); | 125 | _rig->updateFromHeadParameters(params); |
| 126 | } else { | 126 | } else if (true/*_owningAvatar->getHead()->isLookingAtMe()*/) { |
| 127 | // This is a little more work than we really want. | ||
| 128 | // | ||
| 129 | // Other avatars joint, including their eyes, should already be set just like any other joints | 127 | // Other avatars joint, including their eyes, should already be set just like any other joints |
| 130 | // from the wire data. But when looking at me, we want the eyes to use the corrected lookAt. | 128 | // from the wire data. But when looking at me, we want the eyes to use the corrected lookAt. |
| 131 | // | 129 | // |
| 132 | // Thus this should really only be ... else if (_owningAvatar->getHead()->isLookingAtMe()) {... | ||
| 133 | // However, in the !isLookingAtMe case, the eyes aren't rotating the way they should right now. | ||
| 134 | // (They latch their looking at me position.) We will revisit that as priorities allow. | ||
| 135 | const FBXGeometry& geometry = _geometry->getFBXGeometry(); | 130 | const FBXGeometry& geometry = _geometry->getFBXGeometry(); |
| 136 | Head* head = _owningAvatar->getHead(); | 131 | Head* head = _owningAvatar->getHead(); |
| 137 | _rig->updateEyeJoints(geometry.leftEyeJointIndex, geometry.rightEyeJointIndex, | 132 | // If the head is not positioned, updateEyeJoints won't get the math right |
| 138 | getTranslation(), getRotation(), | 133 | glm::quat headOrientation; |
| 139 | head->getFinalOrientationInWorldFrame(), head->getCorrectedLookAtPosition()); | 134 | _rig->getJointRotation(geometry.headJointIndex, headOrientation); |
| 135 | glm::quat modelOrientation = getRotation(); | ||
| 136 | glm::quat adjust = modelOrientation; | ||
| 137 | glm::quat headOrientationInAvatar = adjust * headOrientation; | ||
| 138 | glm::vec3 eulers = safeEulerAngles(headOrientationInAvatar); | ||
| 139 | head->setBasePitch(glm::degrees(-eulers.x)); | ||
| 140 | _rig->updateEyeJoints(geometry.leftEyeJointIndex, geometry.rightEyeJointIndex, | ||
| 141 | getTranslation(), modelOrientation, | ||
| 142 | head->getFinalOrientationInWorldFrame(), head->getCorrectedLookAtPosition()); | ||
| 140 | } | 143 | } |
| 141 | } | 144 | } |
| 142 | 145 | ||