[Client] Assign LocalActor movement settings before rotations get reset

pull/199/head
David Cernat 8 years ago
parent 1fb11dafef
commit d2178e5414

@ -1661,6 +1661,26 @@ void CharacterController::update(float duration)
if(mHitState != CharState_None && mJumpState == JumpState_None)
vec = osg::Vec3f(0.f, 0.f, 0.f);
/*
Start of tes3mp addition
Character movement setting rotations get reset here, so we have to assign movement
settings to a relevant LocalActor now
*/
if (isLocalActor)
{
localActor->direction.pos[0] = cls.getMovementSettings(mPtr).mPosition[0];
localActor->direction.pos[1] = cls.getMovementSettings(mPtr).mPosition[1];
localActor->direction.pos[2] = cls.getMovementSettings(mPtr).mPosition[2];
localActor->direction.rot[0] = cls.getMovementSettings(mPtr).mRotation[0];
localActor->direction.rot[1] = cls.getMovementSettings(mPtr).mRotation[1];
localActor->direction.rot[2] = cls.getMovementSettings(mPtr).mRotation[2];
}
/*
End of tes3mp addition
*/
osg::Vec3f rot = cls.getRotationVector(mPtr);
speed = cls.getSpeed(mPtr);
@ -1947,25 +1967,6 @@ void CharacterController::update(float duration)
movement = vec;
/*
Start of tes3mp addition
Character movement setting positions get reset here, so we have to assign them to a
relevant LocalActor now
*/
if (isLocalActor)
{
localActor->direction.pos[0] = cls.getMovementSettings(mPtr).mPosition[0];
localActor->direction.pos[1] = cls.getMovementSettings(mPtr).mPosition[1];
localActor->direction.pos[2] = cls.getMovementSettings(mPtr).mPosition[2];
localActor->direction.rot[0] = cls.getMovementSettings(mPtr).mRotation[0];
localActor->direction.rot[1] = cls.getMovementSettings(mPtr).mRotation[1];
localActor->direction.rot[2] = cls.getMovementSettings(mPtr).mRotation[2];
}
/*
End of tes3mp addition
*/
cls.getMovementSettings(mPtr).mPosition[0] = cls.getMovementSettings(mPtr).mPosition[1] = 0;
// Can't reset jump state (mPosition[2]) here; we don't know for sure whether the PhysicSystem will actually handle it in this frame

@ -172,7 +172,7 @@ void LocalActor::setPtr(const MWWorld::Ptr& newPtr)
mpNum = ptr.getCellRef().getMpNum();
lastDrawState = ptr.getClass().getNpcStats(ptr).getDrawState();
oldHealth = *(&ptr.getClass().getCreatureStats(ptr).getHealth());
oldMagicka = *(&ptr.getClass().getCreatureStats(ptr).getMagicka());
oldFatigue = *(&ptr.getClass().getCreatureStats(ptr).getFatigue());
oldHealth = ptr.getClass().getCreatureStats(ptr).getHealth();
oldMagicka = ptr.getClass().getCreatureStats(ptr).getMagicka();
oldFatigue = ptr.getClass().getCreatureStats(ptr).getFatigue();
}

Loading…
Cancel
Save