forked from teamnwah/openmw-tes3coop
Fix visual glitch when jumping without adjusting camera afterwards
This commit is contained in:
parent
fc4d8b82fb
commit
7b187d0295
1 changed files with 18 additions and 0 deletions
|
@ -133,6 +133,9 @@ void LocalPlayer::updatePosition(bool forceUpdate)
|
|||
|
||||
static bool posChanged = false;
|
||||
|
||||
static bool isJumping = false;
|
||||
static bool sentJumpEnd = true;
|
||||
|
||||
ESM::Position _pos = player.getRefData().getPosition();
|
||||
|
||||
const bool isChangedPos = (move.mPosition[0] != 0 || move.mPosition[1] != 0 || move.mPosition[2] != 0
|
||||
|
@ -142,6 +145,9 @@ void LocalPlayer::updatePosition(bool forceUpdate)
|
|||
{
|
||||
posChanged = isChangedPos;
|
||||
|
||||
if (!isJumping && !world->isOnGround(player) && !world->isFlying(player)) {
|
||||
isJumping = true;
|
||||
}
|
||||
|
||||
(*Position()) = _pos;
|
||||
|
||||
|
@ -151,6 +157,18 @@ void LocalPlayer::updatePosition(bool forceUpdate)
|
|||
|
||||
GetNetworking()->GetPacket(ID_GAME_UPDATE_POS)->Send(this);
|
||||
}
|
||||
else if (isJumping && world->isOnGround(player)) {
|
||||
|
||||
isJumping = false;
|
||||
sentJumpEnd = false;
|
||||
}
|
||||
// Packet with jump end position has to be sent one tick after above check
|
||||
else if (!sentJumpEnd) {
|
||||
|
||||
sentJumpEnd = true;
|
||||
(*Position()) = _pos;
|
||||
GetNetworking()->GetPacket(ID_GAME_UPDATE_POS)->Send(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue