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

0.6.1
David Cernat 8 years ago
parent ea2a060c67
commit b0c1aafc5a

@ -71,9 +71,10 @@ void DedicatedActor::move(float dt)
{
ESM::Position refPos = ptr.getRefData().getPosition();
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
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
// the interpolated position will be invalid, causing a slight hopping glitch

@ -97,9 +97,10 @@ void DedicatedPlayer::move(float dt)
ESM::Position refPos = ptr.getRefData().getPosition();
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
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)
{

Loading…
Cancel
Save