1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-01 07:39:43 +00:00

[Client] Use a 10 times higher maximum distance for linear interpolation

This commit is contained in:
David Cernat 2017-05-28 03:30:23 +03:00
parent ea2a060c67
commit b0c1aafc5a
2 changed files with 4 additions and 2 deletions

View file

@ -71,9 +71,10 @@ void DedicatedActor::move(float dt)
{ {
ESM::Position refPos = ptr.getRefData().getPosition(); ESM::Position refPos = ptr.getRefData().getPosition();
MWBase::World *world = MWBase::Environment::get().getWorld(); MWBase::World *world = MWBase::Environment::get().getWorld();
const int maxInterpolationDistance = 40;
// Apply interpolation only if the position hasn't changed too much from last time // Apply interpolation only if the position hasn't changed too much from last time
bool shouldInterpolate = abs(position.pos[0] - refPos.pos[0]) < 4 && abs(position.pos[1] - refPos.pos[1]) < 4 && abs(position.pos[2] - refPos.pos[2]) < 4; bool shouldInterpolate = abs(position.pos[0] - refPos.pos[0]) < maxInterpolationDistance && abs(position.pos[1] - refPos.pos[1]) < maxInterpolationDistance && abs(position.pos[2] - refPos.pos[2]) < maxInterpolationDistance;
// Don't apply linear interpolation if the DedicatedActor has just gone through a cell change, because // Don't apply linear interpolation if the DedicatedActor has just gone through a cell change, because
// the interpolated position will be invalid, causing a slight hopping glitch // the interpolated position will be invalid, causing a slight hopping glitch

View file

@ -97,9 +97,10 @@ void DedicatedPlayer::move(float dt)
ESM::Position refPos = ptr.getRefData().getPosition(); ESM::Position refPos = ptr.getRefData().getPosition();
MWBase::World *world = MWBase::Environment::get().getWorld(); MWBase::World *world = MWBase::Environment::get().getWorld();
const int maxInterpolationDistance = 40;
// Apply interpolation only if the position hasn't changed too much from last time // Apply interpolation only if the position hasn't changed too much from last time
bool shouldInterpolate = abs(position.pos[0] - refPos.pos[0]) < 4 && abs(position.pos[1] - refPos.pos[1]) < 4 && abs(position.pos[2] - refPos.pos[2]) < 4; bool shouldInterpolate = abs(position.pos[0] - refPos.pos[0]) < maxInterpolationDistance && abs(position.pos[1] - refPos.pos[1]) < maxInterpolationDistance && abs(position.pos[2] - refPos.pos[2]) < maxInterpolationDistance;
if (shouldInterpolate) if (shouldInterpolate)
{ {