mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 08:48:53 +02:00
Adjustments based on PR feedback, though it looks like this snap-turn-snafu-story is not yet complete.
This commit is contained in:
parent
ca4b563768
commit
d7ed727faf
1 changed files with 3 additions and 9 deletions
|
@ -117,7 +117,6 @@ MyAvatar::MyAvatar(QThread* thread, RigPointer rig) :
|
||||||
_realWorldFieldOfView("realWorldFieldOfView",
|
_realWorldFieldOfView("realWorldFieldOfView",
|
||||||
DEFAULT_REAL_WORLD_FIELD_OF_VIEW_DEGREES),
|
DEFAULT_REAL_WORLD_FIELD_OF_VIEW_DEGREES),
|
||||||
_useAdvancedMovementControls("advancedMovementForHandControllersIsChecked", false),
|
_useAdvancedMovementControls("advancedMovementForHandControllersIsChecked", false),
|
||||||
_smoothOrientationTime(SMOOTH_TIME_ORIENTATION),
|
|
||||||
_smoothOrientationTimer(std::numeric_limits<float>::max()),
|
_smoothOrientationTimer(std::numeric_limits<float>::max()),
|
||||||
_smoothOrientationInitial(),
|
_smoothOrientationInitial(),
|
||||||
_smoothOrientationTarget(),
|
_smoothOrientationTarget(),
|
||||||
|
@ -270,12 +269,12 @@ QVariant MyAvatar::getOrientationVar() const {
|
||||||
|
|
||||||
glm::quat MyAvatar::getOrientationOutbound() const {
|
glm::quat MyAvatar::getOrientationOutbound() const {
|
||||||
// Allows MyAvatar to send out smoothed data to remote agents if required.
|
// Allows MyAvatar to send out smoothed data to remote agents if required.
|
||||||
if (_smoothOrientationTimer > _smoothOrientationTime) {
|
if (_smoothOrientationTimer > SMOOTH_TIME_ORIENTATION) {
|
||||||
return (getLocalOrientation());
|
return (getLocalOrientation());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Smooth the remote avatar movement.
|
// Smooth the remote avatar movement.
|
||||||
float t = _smoothOrientationTimer / _smoothOrientationTime;
|
float t = _smoothOrientationTimer / SMOOTH_TIME_ORIENTATION;
|
||||||
float interp = Interpolate::easeInOutQuad(glm::clamp(t, 0.0f, 1.0f));
|
float interp = Interpolate::easeInOutQuad(glm::clamp(t, 0.0f, 1.0f));
|
||||||
return (slerp(_smoothOrientationInitial, _smoothOrientationTarget, interp));
|
return (slerp(_smoothOrientationInitial, _smoothOrientationTarget, interp));
|
||||||
}
|
}
|
||||||
|
@ -402,14 +401,9 @@ void MyAvatar::update(float deltaTime) {
|
||||||
float tau = deltaTime / HMD_FACING_TIMESCALE;
|
float tau = deltaTime / HMD_FACING_TIMESCALE;
|
||||||
_hmdSensorFacingMovingAverage = lerp(_hmdSensorFacingMovingAverage, _hmdSensorFacing, tau);
|
_hmdSensorFacingMovingAverage = lerp(_hmdSensorFacingMovingAverage, _hmdSensorFacing, tau);
|
||||||
|
|
||||||
if (_smoothOrientationTimer < _smoothOrientationTime) {
|
if (_smoothOrientationTimer < SMOOTH_TIME_ORIENTATION) {
|
||||||
_rotationChanged = true;
|
_rotationChanged = true;
|
||||||
_smoothOrientationTimer+= deltaTime;
|
_smoothOrientationTimer+= deltaTime;
|
||||||
|
|
||||||
if (_smoothOrientationTimer >= _smoothOrientationTime) {
|
|
||||||
// Take it back to astronomical value land.
|
|
||||||
_smoothOrientationTimer = std::numeric_limits<float>::max();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_DRAW_HMD_MOVING_AVERAGE
|
#ifdef DEBUG_DRAW_HMD_MOVING_AVERAGE
|
||||||
|
|
Loading…
Reference in a new issue