History

Set head pitch before making downstream eye corrections.

Howard Stearns committed 11 years ago

Commit 484db871 parent a8bbd8d1 file · +13 −10Browse files

Showing the changes to interface/src/avatar/SkeletonModel.cpp (1 of 1 file). Show all

Unified · Split

interface/src/avatar/SkeletonModel.cpp+13−10
@@ -41,7 +41,7 @@ SkeletonModel::~SkeletonModel() { · 40 unmodified lines
4141
4242 void SkeletonModel::initJointStates(QVector<JointState> states) {
4343 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())*/;
4545
4646 int rootJointIndex = geometry.rootJointIndex;
4747 int leftHandJointIndex = geometry.leftHandJointIndex;
@@ -123,20 +123,23 @@ void SkeletonModel::updateRig(float deltaTime, glm::mat4 parentTransform) { · 75 unmodified lines
123123 params.rightEyeJointIndex = geometry.rightEyeJointIndex;
124124
125125 _rig->updateFromHeadParameters(params);
126− } else {
127− // This is a little more work than we really want.
128− //
126+ } else if (true/*_owningAvatar->getHead()->isLookingAtMe()*/) {
129127 // Other avatars joint, including their eyes, should already be set just like any other joints
130128 // from the wire data. But when looking at me, we want the eyes to use the corrected lookAt.
131129 //
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.
135130 const FBXGeometry& geometry = _geometry->getFBXGeometry();
136131 Head* head = _owningAvatar->getHead();
137− _rig->updateEyeJoints(geometry.leftEyeJointIndex, geometry.rightEyeJointIndex,
138− getTranslation(), getRotation(),
139− head->getFinalOrientationInWorldFrame(), head->getCorrectedLookAtPosition());
132+ // If the head is not positioned, updateEyeJoints won't get the math right
133+ glm::quat headOrientation;
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());
140143 }
141144 }
142145

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t