mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-04 11:35:06 +03:00
Fixed editor camera spinning
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user