diff --git a/interface/src/avatar/FaceModel.cpp b/interface/src/avatar/FaceModel.cpp index 61005481a8..d164d5c899 100644 --- a/interface/src/avatar/FaceModel.cpp +++ b/interface/src/avatar/FaceModel.cpp @@ -65,7 +65,7 @@ void FaceModel::maybeUpdateNeckRotation(const JointState& parentState, const FBX void FaceModel::maybeUpdateEyeRotation(const JointState& parentState, const FBXJoint& joint, JointState& state) { // likewise with the eye joints - glm::mat4 inverse = glm::inverse(parentState.transform * + glm::mat4 inverse = glm::inverse(parentState.transform * glm::translate(state.translation) * joint.preTransform * glm::mat4_cast(joint.preRotation * joint.rotation)); glm::vec3 front = glm::vec3(inverse * glm::vec4(_owningHead->getOrientation() * IDENTITY_FRONT, 0.0f)); glm::vec3 lookAt = glm::vec3(inverse * glm::vec4(_owningHead->getLookAtPosition() + diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 02e89c9df5..3c5fdb243f 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -180,29 +180,22 @@ void MyAvatar::simulate(float deltaTime, Transmitter* transmitter) { const float OCULUS_ACCELERATION_PULL_THRESHOLD = 1.0f; const int OCULUS_YAW_OFFSET_THRESHOLD = 10; - if (!Application::getInstance()->getFaceshift()->isActive()) { - // Decay HeadPitch as a function of acceleration, so that you look straight ahead when - // you start moving, but don't do this with an HMD like the Oculus. - if (!OculusManager::isConnected()) { - if (forwardAcceleration > ACCELERATION_PULL_THRESHOLD) { - _head.setMousePitch(_head.getMousePitch() * qMax(0.0f, - (1.f - forwardAcceleration * ACCELERATION_PITCH_DECAY * deltaTime))); - } - } else if (fabsf(forwardAcceleration) > OCULUS_ACCELERATION_PULL_THRESHOLD - && fabs(_head.getYaw()) > OCULUS_YAW_OFFSET_THRESHOLD) { - // if we're wearing the oculus - // and this acceleration is above the pull threshold - // and the head yaw if off the body by more than OCULUS_YAW_OFFSET_THRESHOLD + if (!Application::getInstance()->getFaceshift()->isActive() && OculusManager::isConnected() && + fabsf(forwardAcceleration) > OCULUS_ACCELERATION_PULL_THRESHOLD && + fabs(_head.getYaw()) > OCULUS_YAW_OFFSET_THRESHOLD) { + + // if we're wearing the oculus + // and this acceleration is above the pull threshold + // and the head yaw if off the body by more than OCULUS_YAW_OFFSET_THRESHOLD - // match the body yaw to the oculus yaw - _bodyYaw = getAbsoluteHeadYaw(); + // match the body yaw to the oculus yaw + _bodyYaw = getAbsoluteHeadYaw(); - // set the head yaw to zero for this draw - _head.setYaw(0); + // set the head yaw to zero for this draw + _head.setYaw(0); - // correct the oculus yaw offset - OculusManager::updateYawOffset(); - } + // correct the oculus yaw offset + OculusManager::updateYawOffset(); } const float WALKING_SPEED_THRESHOLD = 0.2f;