mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-29 18:32:36 +00:00
Make interpolateMovement works with PtrHolder instead of Actor
This commit is contained in:
parent
ad7a810a62
commit
a245981e4e
@ -105,10 +105,10 @@ namespace
|
||||
return actorData.mPosition.z() < actorData.mSwimLevel;
|
||||
}
|
||||
|
||||
osg::Vec3f interpolateMovements(MWPhysics::Actor& actor, MWPhysics::ActorFrameData& actorData, float timeAccum, float physicsDt)
|
||||
osg::Vec3f interpolateMovements(const MWPhysics::PtrHolder& ptr, float timeAccum, float physicsDt)
|
||||
{
|
||||
const float interpolationFactor = std::clamp(timeAccum / physicsDt, 0.0f, 1.0f);
|
||||
return actorData.mPosition * interpolationFactor + actor.getPreviousPosition() * (1.f - interpolationFactor);
|
||||
return ptr.getPosition() * interpolationFactor + ptr.getPreviousPosition() * (1.f - interpolationFactor);
|
||||
}
|
||||
|
||||
namespace Visitors
|
||||
@ -190,7 +190,7 @@ namespace
|
||||
else if (heightDiff < 0)
|
||||
stats.addToFallHeight(-heightDiff);
|
||||
|
||||
actor->setSimulationPosition(::interpolateMovements(*actor, frameData, mTimeAccum, mPhysicsDt));
|
||||
actor->setSimulationPosition(::interpolateMovements(*actor, mTimeAccum, mPhysicsDt));
|
||||
actor->setLastStuckPosition(frameData.mLastStuckPosition);
|
||||
actor->setStuckFrames(frameData.mStuckFrames);
|
||||
if (mAdvanceSimulation)
|
||||
|
Loading…
x
Reference in New Issue
Block a user