mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 05:17:02 +02:00
fix vertical jitter (for real this time)
This commit is contained in:
parent
613b270d24
commit
b8f49dc6ef
1 changed files with 6 additions and 4 deletions
|
@ -1324,11 +1324,11 @@ void MyAvatar::updatePosition(float deltaTime) {
|
||||||
bool gravityEnabled = (glm::length2(_gravity) > EPSILON);
|
bool gravityEnabled = (glm::length2(_gravity) > EPSILON);
|
||||||
if (gravityEnabled) {
|
if (gravityEnabled) {
|
||||||
const float SLOP = 0.002f;
|
const float SLOP = 0.002f;
|
||||||
if (heightAboveFloor < 0.0f) {
|
if (heightAboveFloor < SLOP) {
|
||||||
if (heightAboveFloor < -SLOP) {
|
if (heightAboveFloor < 0.0) {
|
||||||
// Gravity is in effect so we assume that the avatar is colliding against the world and we need
|
// Gravity is in effect so we assume that the avatar is colliding against the world and we need
|
||||||
// to lift avatar out of floor, but we don't want to do it too fast (keep it smooth).
|
// to lift avatar out of floor, but we don't want to do it too fast (keep it smooth).
|
||||||
float distanceToLift = glm::min(SLOP - heightAboveFloor, MAX_WALKING_SPEED * deltaTime);
|
float distanceToLift = glm::min(-heightAboveFloor, MAX_WALKING_SPEED * deltaTime);
|
||||||
|
|
||||||
// We don't use applyPositionDelta() for this lift distance because we don't want the avatar
|
// We don't use applyPositionDelta() for this lift distance because we don't want the avatar
|
||||||
// to come flying out of the floor. Instead we update position directly, and set a boolean
|
// to come flying out of the floor. Instead we update position directly, and set a boolean
|
||||||
|
@ -1337,7 +1337,9 @@ void MyAvatar::updatePosition(float deltaTime) {
|
||||||
}
|
}
|
||||||
zeroDownwardVelocity = true;
|
zeroDownwardVelocity = true;
|
||||||
}
|
}
|
||||||
velocity += (deltaTime * GRAVITY_EARTH) * _gravity;
|
if (!zeroDownwardVelocity) {
|
||||||
|
velocity += (deltaTime * GRAVITY_EARTH) * _gravity;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// rotate velocity into camera frame
|
// rotate velocity into camera frame
|
||||||
|
|
Loading…
Reference in a new issue