From f6aa4a2dd4af4842f0206b097449149deb423906 Mon Sep 17 00:00:00 2001 From: luiscuenca Date: Tue, 22 Oct 2019 11:42:19 -0700 Subject: [PATCH] Head look at should update before rig --- interface/src/avatar/MyAvatar.cpp | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 6e0bfab69b..fa3f6c2461 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -906,6 +906,21 @@ void MyAvatar::simulate(float deltaTime, bool inView) { updateViewBoom(); } + // Head's look at blending needs updating + // before we perform rig animations and IK. + CameraMode mode = qApp->getCamera().getMode(); + if (_scriptControlsHeadLookAt || mode == CAMERA_MODE_FIRST_PERSON_LOOK_AT || mode == CAMERA_MODE_FIRST_PERSON || + mode == CAMERA_MODE_LOOK_AT || mode == CAMERA_MODE_SELFIE) { + if (!_pointAtActive || !_isPointTargetValid) { + updateHeadLookAt(deltaTime); + } else { + resetHeadLookAt(); + } + } else if (_headLookAtActive) { + resetHeadLookAt(); + _headLookAtActive = false; + } + // update sensorToWorldMatrix for camera and hand controllers // before we perform rig animations and IK. updateSensorToWorldMatrix(); @@ -957,18 +972,6 @@ void MyAvatar::simulate(float deltaTime, bool inView) { head->setPosition(headPosition); head->setScale(getModelScale()); head->simulate(deltaTime); - CameraMode mode = qApp->getCamera().getMode(); - if (_scriptControlsHeadLookAt || mode == CAMERA_MODE_FIRST_PERSON_LOOK_AT || mode == CAMERA_MODE_FIRST_PERSON || - mode == CAMERA_MODE_LOOK_AT || mode == CAMERA_MODE_SELFIE) { - if (!_pointAtActive || !_isPointTargetValid) { - updateHeadLookAt(deltaTime); - } else { - resetHeadLookAt(); - } - } else if (_headLookAtActive){ - resetHeadLookAt(); - _headLookAtActive = false; - } } // Record avatars movements.