Avatar: Eye-tracking works again

This replaces the calculation of the Head left and right eye positions used for eye tracking.
Which was inadvertently removed in this commit 7483b8546b
This commit is contained in:
Anthony J. Thibault 2016-03-24 18:03:51 -07:00
parent 17a2ed7dd0
commit 6a5a443eff
2 changed files with 10 additions and 1 deletions

View file

@ -231,6 +231,13 @@ void Head::simulate(float deltaTime, bool isMine, bool billboard) {
_leftEyePosition = _rightEyePosition = getPosition();
_eyePosition = calculateAverageEyePosition();
if (!billboard && _owningAvatar) {
auto skeletonModel = static_cast<Avatar*>(_owningAvatar)->getSkeletonModel();
if (skeletonModel) {
skeletonModel->getEyePositions(_leftEyePosition, _rightEyePosition);
}
}
}
void Head::calculateMouthShapes() {

View file

@ -897,7 +897,9 @@ void MyAvatar::updateLookAtTargetAvatar() {
// Scale by proportional differences between avatar and human.
float humanEyeSeparationInModelSpace = glm::length(humanLeftEye - humanRightEye) * ipdScale;
float avatarEyeSeparation = glm::length(avatarLeftEye - avatarRightEye);
gazeOffset = gazeOffset * humanEyeSeparationInModelSpace / avatarEyeSeparation;
if (avatarEyeSeparation > 0.0f) {
gazeOffset = gazeOffset * humanEyeSeparationInModelSpace / avatarEyeSeparation;
}
}
// And now we can finally add that offset to the camera.