mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 00:08:53 +02:00
Compute only when delta is not zero
This commit is contained in:
parent
8a6cb93a84
commit
793b2917f6
1 changed files with 14 additions and 10 deletions
|
@ -3419,11 +3419,13 @@ void MyAvatar::updateOrientation(float deltaTime) {
|
||||||
_lookAtOffsetYaw = getWorldOrientation();
|
_lookAtOffsetYaw = getWorldOrientation();
|
||||||
_lookAtOffsetPitch = Quaternions::IDENTITY;
|
_lookAtOffsetPitch = Quaternions::IDENTITY;
|
||||||
} else {
|
} else {
|
||||||
// Set look at vector
|
// Compute new look at vectors
|
||||||
|
if (totalBodyYaw > 0.0f) {
|
||||||
|
_lookAtOffsetYaw = _lookAtOffsetYaw * glm::quat(glm::radians(glm::vec3(0.0f, totalBodyYaw, 0.0f)));
|
||||||
|
}
|
||||||
float pitchIncrement = getDriveKey(PITCH) * _pitchSpeed * deltaTime
|
float pitchIncrement = getDriveKey(PITCH) * _pitchSpeed * deltaTime
|
||||||
+ getDriveKey(DELTA_PITCH) * _pitchSpeed / PITCH_SPEED_DEFAULT;
|
+ getDriveKey(DELTA_PITCH) * _pitchSpeed / PITCH_SPEED_DEFAULT;
|
||||||
_lookAtOffsetYaw = _lookAtOffsetYaw * glm::quat(glm::radians(glm::vec3(0.0f, totalBodyYaw, 0.0f)));
|
if (pitchIncrement > 0.0f) {
|
||||||
|
|
||||||
glm::quat _previousLookAtOffsetPitch = _lookAtOffsetPitch;
|
glm::quat _previousLookAtOffsetPitch = _lookAtOffsetPitch;
|
||||||
_lookAtOffsetPitch = _lookAtOffsetPitch * glm::quat(glm::radians(glm::vec3(pitchIncrement, 0.0f, 0.0f)));
|
_lookAtOffsetPitch = _lookAtOffsetPitch * glm::quat(glm::radians(glm::vec3(pitchIncrement, 0.0f, 0.0f)));
|
||||||
// Limit the camera horizontal pitch
|
// Limit the camera horizontal pitch
|
||||||
|
@ -3432,6 +3434,8 @@ void MyAvatar::updateOrientation(float deltaTime) {
|
||||||
if (pitchFromHorizont > MAX_LOOK_AT_PITCH_DEGREES || pitchFromHorizont < -MAX_LOOK_AT_PITCH_DEGREES) {
|
if (pitchFromHorizont > MAX_LOOK_AT_PITCH_DEGREES || pitchFromHorizont < -MAX_LOOK_AT_PITCH_DEGREES) {
|
||||||
_lookAtOffsetPitch = _previousLookAtOffsetPitch;
|
_lookAtOffsetPitch = _previousLookAtOffsetPitch;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Blend the avatar orientation with the camera look at if moving forward.
|
// Blend the avatar orientation with the camera look at if moving forward.
|
||||||
if (faceForward) {
|
if (faceForward) {
|
||||||
const float FACE_FORWARD_BLEND = 0.25f;
|
const float FACE_FORWARD_BLEND = 0.25f;
|
||||||
|
|
Loading…
Reference in a new issue