mirror of
https://github.com/lubosz/overte.git
synced 2025-04-09 13:12:57 +02:00
Code review
This commit is contained in:
parent
e3b4e4aa20
commit
55e0082792
1 changed files with 4 additions and 4 deletions
|
@ -1971,19 +1971,19 @@ void MyAvatar::updateOrientation(float deltaTime) {
|
|||
float speedFactor;
|
||||
if (getDriveKey(TRANSLATE_Z) != 0.0f || _lastDrivenSpeed == 0.0f) {
|
||||
_lastDrivenSpeed = speed;
|
||||
speedFactor = 1.0;
|
||||
speedFactor = 1.0f;
|
||||
} else {
|
||||
speedFactor = glm::min(speed / _lastDrivenSpeed, 1.0f);
|
||||
}
|
||||
|
||||
float direction = glm::dot(getVelocity(), getRotation() * Vectors::UNIT_NEG_Z) > 0.0f ? 1.0f : -1.0f;
|
||||
|
||||
float rollAngle = glm::degrees(asin(glm::dot(IDENTITY_UP, _hmdSensorOrientation * IDENTITY_RIGHT)));
|
||||
float rollAngle = glm::degrees(asinf(glm::dot(IDENTITY_UP, _hmdSensorOrientation * IDENTITY_RIGHT)));
|
||||
float rollSign = rollAngle < 0.0f ? -1.0f : 1.0f;
|
||||
rollAngle = fabsf(rollAngle);
|
||||
rollAngle = rollAngle > _hmdRollControlDeadZone ? rollSign * (rollAngle - _hmdRollControlDeadZone) : 0.0f;
|
||||
|
||||
float yawChange = rollAngle > _hmdRollControlDeadZone ? rollSign * (rollAngle - _hmdRollControlDeadZone) : 0.0f;
|
||||
totalBodyYaw += speedFactor * direction * yawChange * deltaTime * _hmdRollControlSpeed;
|
||||
totalBodyYaw += speedFactor * direction * rollAngle * deltaTime * _hmdRollControlSpeed;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue