From: Daniel Karbach Date: Mon, 19 Oct 2015 15:21:02 +0000 (+0200) Subject: restore orientation on player load X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=fcb9cdbbb01dbe4a86981e1529df451d7d5e8256;p=blank.git restore orientation on player load only works for yaw, obviously --- diff --git a/src/client/InteractiveState.hpp b/src/client/InteractiveState.hpp index b86258e..49c5474 100644 --- a/src/client/InteractiveState.hpp +++ b/src/client/InteractiveState.hpp @@ -38,6 +38,7 @@ public: World &GetWorld() noexcept { return world; } Player &GetPlayer() noexcept { return player; } + PlayerController &GetPlayerController() noexcept { return input; } ChunkReceiver &GetChunkReceiver() noexcept { return chunk_receiver; } void OnEnter() override; diff --git a/src/client/client.cpp b/src/client/client.cpp index 97292a9..fd4fbee 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -380,6 +380,8 @@ void MasterState::On(const Packet::Join &pack) { state.reset(new InteractiveState(*this, player_id)); pack.ReadPlayerState(state->GetPlayer().GetEntity().GetState()); + glm::vec3 orient(glm::eulerAngles(state->GetPlayer().GetEntity().Orientation())); + state->GetPlayerController().TurnHead(orient.x, orient.y); env.state.PopAfter(this); env.state.Push(state.get()); diff --git a/src/standalone/MasterState.cpp b/src/standalone/MasterState.cpp index 1035bb2..750e491 100644 --- a/src/standalone/MasterState.cpp +++ b/src/standalone/MasterState.cpp @@ -51,6 +51,8 @@ MasterState::MasterState( chunk_renderer.FogDensity(wc.fog_density); if (save.Exists(player)) { save.Read(player); + glm::vec3 orient(glm::eulerAngles(player.GetEntity().Orientation())); + input.TurnHead(orient.x, orient.y); } else { spawn_player = true; }