From e31cf7e6ac691663bf093cdc92a3ff1dfa998693 Mon Sep 17 00:00:00 2001 From: fredzio Date: Thu, 15 Apr 2021 22:32:42 +0200 Subject: [PATCH] Follow up MR 722: do not apply mPositionOffset twice when we teleport. Previous MR change the meaning of mPositionOffset: it is now just a log of relative movement that were already applied to allow the physics simulation to catch up, instead of changes that needs to be applied. As such, after a teleport we need to reset it. Also, since mWorldPosition is already with the offset we should not update its value in applyPositionOffset(). --- apps/openmw/mwphysics/actor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwphysics/actor.cpp b/apps/openmw/mwphysics/actor.cpp index f9adc9bc6..f14805c6f 100644 --- a/apps/openmw/mwphysics/actor.cpp +++ b/apps/openmw/mwphysics/actor.cpp @@ -121,6 +121,7 @@ void Actor::updatePosition() mPreviousPosition = mWorldPosition; mPosition = mWorldPosition; mSimulationPosition = mWorldPosition; + mPositionOffset = osg::Vec3f(); mStandingOnPtr = nullptr; mSkipSimulation = true; } @@ -196,7 +197,6 @@ void Actor::applyOffsetChange() { if (mPositionOffset.length() == 0) return; - mWorldPosition += mPositionOffset; mPosition += mPositionOffset; mPreviousPosition += mPositionOffset; mSimulationPosition += mPositionOffset;