1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-30 16:45:33 +00:00

[VR Client] Synchronize player rotating in place without position change

This commit is contained in:
David Cernat 2022-03-01 23:38:10 +02:00
parent 455356160e
commit 82df73f733

View file

@ -17,6 +17,18 @@
#include "../mwmechanics/movement.hpp"
/*
Start of tes3mp addition
Include additional headers for multiplayer purposes
*/
#include "../mwmp/Main.hpp"
#include "../mwmp/Networking.hpp"
#include "../mwmp/LocalPlayer.hpp"
/*
End of tes3mp addition
*/
#include <osg/Quat>
namespace MWVR
@ -80,6 +92,18 @@ namespace MWVR
if (!player.isDisabled() && mTrackingNode)
{
world->rotateObject(playerPtr, pitch, 0.f, yaw, MWBase::RotationFlag_none);
/*
Start of tes3mp addition
Set the player's direction here, because VR doesn't do it from CharacterController::update()
*/
mwmp::LocalPlayer *localPlayer = mwmp::Main::get().getLocalPlayer();
localPlayer->direction.rot[0] = playerPtr.getRefData().getPosition().rot[0] - localPlayer->position.rot[0];
localPlayer->direction.rot[2] = playerPtr.getRefData().getPosition().rot[2] - localPlayer->position.rot[2];
/*
End of tes3mp addition
*/
}
}