diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index bb3bc55307..86b420f7f4 100755 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2010,6 +2010,13 @@ void Application::update(float deltaTime) { void Application::updateAvatar(float deltaTime) { + // When head is rotated via touch/mouse look, slowly turn body to follow + const float BODY_FOLLOW_HEAD_RATE = 0.5f; + // update body yaw by body yaw delta + _myAvatar.setOrientation(_myAvatar.getOrientation() + * glm::quat(glm::vec3(0, _yawFromTouch * deltaTime * BODY_FOLLOW_HEAD_RATE, 0) * deltaTime)); + _yawFromTouch -= _yawFromTouch * deltaTime * BODY_FOLLOW_HEAD_RATE; + // Update my avatar's state from gyros and/or webcam _myAvatar.updateFromGyrosAndOrWebcam(_gyroLook->isChecked(), glm::vec3(_headCameraPitchYawScale, diff --git a/interface/src/Avatar.cpp b/interface/src/Avatar.cpp index 6e028e3674..ab57d6d0df 100755 --- a/interface/src/Avatar.cpp +++ b/interface/src/Avatar.cpp @@ -544,7 +544,7 @@ void Avatar::simulate(float deltaTime, Transmitter* transmitter) { // add thrust to velocity _velocity += _thrust * deltaTime; - + // update body yaw by body yaw delta orientation = orientation * glm::quat(glm::radians( glm::vec3(_bodyPitchDelta, _bodyYawDelta, _bodyRollDelta) * deltaTime));