1
0

Improve entity position updates (#4701)

* Make puking pickups fly nicer

* Improve entity position updates

* Move determination of whether a delta is too big for a packet into the protocol handlers
+ Less jittery movement
+ Generalise CollectEntity to take any entity
This commit is contained in:
Tiger Wang
2020-05-04 09:10:47 +01:00
committed by GitHub
parent 258318ab98
commit 07ca095740
23 changed files with 294 additions and 404 deletions

View File

@@ -49,19 +49,11 @@ void cBoat::BroadcastMovementUpdate(const cClientHandle * a_Exclude)
}
Vector3i Diff = (GetPosition() * 32.0).Floor() - (m_LastSentPosition * 32.0).Floor();
if (Diff.HasNonZeroLength()) // Have we moved?
{
if ((abs(Diff.x) <= 127) && (abs(Diff.y) <= 127) && (abs(Diff.z) <= 127)) // Limitations of a Byte
{
m_World->BroadcastEntityRelMove(*this, Vector3<Int8>(Diff), a_Exclude);
}
else
{
// Too big a movement, do a teleport
m_World->BroadcastTeleportEntity(*this, a_Exclude);
}
m_World->BroadcastEntityPosition(*this, a_Exclude);
m_LastSentPosition = GetPosition();
m_bDirtyOrientation = false;
}
}