[General] Temporarily revert to original rotation animation sync

I originally added rotation animation sync as part of commit 068a45be87. Unfortunately, it meant the PlayerPosition packets were now twice as large as they had been before, which was less than ideal for such a frequently sent packet, which is why Koncord switched to a more optimized approach in commits 5f30dfd5db and d67db1a9bd.

Recently, there have since been some rotation animation problems in OpenMW, which have broken the way Koncord's approach looks. My original approach still looks somewhat okay, so I'm switching back to it until we can figure out how to reuse it under the current circumstances.
fix/skillcap
David Cernat 7 years ago
parent 3944c8aec6
commit 038757b91a

@ -1871,6 +1871,10 @@ void CharacterController::update(float duration)
MWMechanics::Movement &movementSettings = cls.getMovementSettings(mPtr);
localPlayer->direction.pos[0] = movementSettings.mPosition[0];
localPlayer->direction.pos[1] = movementSettings.mPosition[1];
localPlayer->direction.pos[2] = movementSettings.mPosition[2];
localPlayer->direction.rot[0] = movementSettings.mRotation[0];
localPlayer->direction.rot[1] = movementSettings.mRotation[1];
localPlayer->direction.rot[2] = movementSettings.mRotation[2];
}
else if (mwmp::Main::get().getCellController()->isLocalActor(mPtr))
{

@ -133,14 +133,20 @@ void DedicatedPlayer::move(float dt)
else
world->moveObject(ptr, position.pos[0], position.pos[1], position.pos[2]);
float oldZ = ptr.getRefData().getPosition().rot[2];
world->rotateObject(ptr, position.rot[0], 0, oldZ);
world->rotateObject(ptr, position.rot[0], 0, position.rot[2]);
MWMechanics::Movement *move = &ptr.getClass().getMovementSettings(ptr);
move->mPosition[0] = direction.pos[0];
move->mPosition[1] = direction.pos[1];
move->mPosition[2] = direction.pos[2];
MWMechanics::zTurn(ptr, position.rot[2], osg::DegreesToRadians(1.0));
// Make sure the values are valid, or we'll get an infinite error loop
if (!isnan(direction.rot[0]) && !isnan(direction.rot[1]) && !isnan(direction.rot[2]))
{
move->mRotation[0] = direction.rot[0];
move->mRotation[1] = direction.rot[1];
move->mRotation[2] = direction.rot[2];
}
}
void DedicatedPlayer::setBaseInfo()

@ -383,7 +383,7 @@ void LocalPlayer::updatePosition(bool forceUpdate)
position = ptrPlayer.getRefData().getPosition();
bool posIsChanging = (direction.pos[0] != 0 || direction.pos[1] != 0 ||
position.rot[0] != oldRot[0] || position.rot[2] != oldRot[1]);
direction.rot[0] != 0 || direction.rot[1] != 0 || direction.rot[2] != 0);
// Animations can change a player's position without actually creating directional movement,
// so update positions accordingly

@ -19,27 +19,6 @@ void PacketPlayerPosition::Packet(RakNet::BitStream *bs, bool send)
{
PlayerPacket::Packet(bs, send);
float rot[2];
unsigned char dir;
if (send)
{
rot[0] = player->position.rot[0] * 0.1f;
rot[1] = player->position.rot[2] * 0.1f;
dir = (player->direction.pos[0] >= 0 ? (unsigned char)(player->direction.pos[0]) : (unsigned char) 0x3) << 2; // pack direction
dir += (player->direction.pos[1] >= 0 ? (unsigned char)(player->direction.pos[1]) : (unsigned char) 0x3);
}
RW(rot[0], send, true);
RW(rot[1], send, true);
RW(player->position.pos, send, true);
RW(dir, send);
if (!send)
{
player->position.rot[0] = rot[0] / 0.1f;
player->position.rot[2] = rot[1] / 0.1f;
player->direction.pos[0] = (dir >> 2) == 0x3 ? -1 : dir >> 2; // unpack direction
player->direction.pos[1] = (dir & 0x3) == 0x3 ? -1 : dir & 0x3;
}
RW(player->position, send, 1);
RW(player->direction, send, 1);
}

Loading…
Cancel
Save