mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 02:37:00 +02:00
Body slowly turns to follow touch look
This commit is contained in:
parent
4e89c679b9
commit
4e9530f946
2 changed files with 8 additions and 1 deletions
|
@ -2010,6 +2010,13 @@ void Application::update(float deltaTime) {
|
||||||
|
|
||||||
void Application::updateAvatar(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
|
// Update my avatar's state from gyros and/or webcam
|
||||||
_myAvatar.updateFromGyrosAndOrWebcam(_gyroLook->isChecked(),
|
_myAvatar.updateFromGyrosAndOrWebcam(_gyroLook->isChecked(),
|
||||||
glm::vec3(_headCameraPitchYawScale,
|
glm::vec3(_headCameraPitchYawScale,
|
||||||
|
|
|
@ -544,7 +544,7 @@ void Avatar::simulate(float deltaTime, Transmitter* transmitter) {
|
||||||
|
|
||||||
// add thrust to velocity
|
// add thrust to velocity
|
||||||
_velocity += _thrust * deltaTime;
|
_velocity += _thrust * deltaTime;
|
||||||
|
|
||||||
// update body yaw by body yaw delta
|
// update body yaw by body yaw delta
|
||||||
orientation = orientation * glm::quat(glm::radians(
|
orientation = orientation * glm::quat(glm::radians(
|
||||||
glm::vec3(_bodyPitchDelta, _bodyYawDelta, _bodyRollDelta) * deltaTime));
|
glm::vec3(_bodyPitchDelta, _bodyYawDelta, _bodyRollDelta) * deltaTime));
|
||||||
|
|
Loading…
Reference in a new issue