mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 11:45:36 +02:00
Move head back to center when moving
This commit is contained in:
parent
85ea48e43a
commit
be1fae5958
1 changed files with 2 additions and 0 deletions
|
@ -378,11 +378,13 @@ void Avatar::simulate(float deltaTime, Transmitter* transmitter) {
|
|||
// Compute instantaneous acceleration
|
||||
float acceleration = glm::distance(getVelocity(), oldVelocity) / deltaTime;
|
||||
const float ACCELERATION_PITCH_DECAY = 0.4f;
|
||||
const float ACCELERATION_YAW_DECAY = 0.4f;
|
||||
|
||||
// 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()) {
|
||||
_head.setPitch(_head.getPitch() * (1.f - acceleration * ACCELERATION_PITCH_DECAY * deltaTime));
|
||||
_head.setYaw(_head.getYaw() * (1.f - acceleration * ACCELERATION_YAW_DECAY * deltaTime));
|
||||
}
|
||||
|
||||
//apply the head lean values to the springy position...
|
||||
|
|
Loading…
Reference in a new issue