From 6785bb7c165b1d5be87ebf414d877c774eeac708 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 8 Dec 2013 13:08:56 +0100 Subject: Fixed normalizing large angles. --- src/Entities/Entity.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/Entities/Entity.cpp') diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 91be6dd93..d728d6cbc 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -158,8 +158,7 @@ bool cEntity::Initialize(cWorld * a_World) void cEntity::WrapHeadYaw(void) { - while (m_HeadYaw > 180.f) m_HeadYaw -= 360.f; // Wrap it - while (m_HeadYaw < -180.f) m_HeadYaw += 360.f; + m_HeadYaw = NormalizeAngleDegrees(m_HeadYaw); } @@ -168,10 +167,8 @@ void cEntity::WrapHeadYaw(void) void cEntity::WrapRotation(void) { - while (m_Rot.x > 180.f) m_Rot.x -= 360.f; // Wrap it - while (m_Rot.x < -180.f) m_Rot.x += 360.f; - while (m_Rot.y > 180.f) m_Rot.y -= 360.f; - while (m_Rot.y < -180.f) m_Rot.y += 360.f; + m_Rot.x = NormalizeAngleDegrees(m_Rot.x); + m_Rot.y = NormalizeAngleDegrees(m_Rot.z); } -- cgit v1.2.3