diff --git a/Nuake/src/Scene/EditorCamera.cpp b/Nuake/src/Scene/EditorCamera.cpp index 7b5a1242..6674708d 100644 --- a/Nuake/src/Scene/EditorCamera.cpp +++ b/Nuake/src/Scene/EditorCamera.cpp @@ -206,12 +206,14 @@ namespace Nuake void EditorCamera::SetYaw(float yaw) { TargetYaw = yaw; + Yaw = yaw; UpdateDirection(); } void EditorCamera::SetPitch(float pitch) { TargetPitch = pitch; + Pitch = pitch; UpdateDirection(); } @@ -220,8 +222,8 @@ namespace Nuake BEGIN_SERIALIZE(); SERIALIZE_VEC3(Translation); - j["Yaw"] = Yaw; - j["Pitch"] = Pitch; + j["Yaw"] = glm::clamp(Yaw, 0.f, 360.f); + j["Pitch"] = glm::clamp(Pitch, -90.f, 90.f); return j; } diff --git a/Nuake/src/Scene/EditorCamera.h b/Nuake/src/Scene/EditorCamera.h index d7364884..eb7e974b 100644 --- a/Nuake/src/Scene/EditorCamera.h +++ b/Nuake/src/Scene/EditorCamera.h @@ -10,6 +10,7 @@ namespace Nuake public: EditorCamera() { + Yaw = 0.0f; Translation = Vector3(10, 10, 10); SetDirection(Vector3(-1, -1, -1)); } @@ -33,10 +34,10 @@ namespace Nuake float mouseLastX; float mouseLastY; - float Yaw = -135.f; - float Pitch = -45.f; - float TargetYaw = -135.f; - float TargetPitch = -45.f; + float Yaw = 0.0f; + float Pitch = 0.0f; + float TargetYaw = 0.f; + float TargetPitch = 0.0f; void UpdateDirection(); }; }