From d710f42f0c7fd0e63d3b9d5c790cbd1a30b53cdf Mon Sep 17 00:00:00 2001 From: Daniel Tian Date: Mon, 1 May 2023 01:28:00 -1000 Subject: [PATCH] =?UTF-8?q?Limit=20camera=20pitch=20movement=20to=20+/-=20?= =?UTF-8?q?90=C2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Camera.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Camera.cpp b/Camera.cpp index 58d9c699..9957fe5b 100644 --- a/Camera.cpp +++ b/Camera.cpp @@ -167,14 +167,10 @@ void TCamera::Update() Angle.y += 2 * M_PI; } - Angle.x -= m_rotationoffsets.x * rotationfactor; + // Limit the camera pitch to +/- 90°. + Angle.x = clamp(Angle.x - (m_rotationoffsets.x * rotationfactor), -M_PI_2, M_PI_2); m_rotationoffsets.x *= ( 1.0 - rotationfactor ); - if( m_owner != nullptr ) { - // jeżeli jazda z pojazdem ograniczenie kąta spoglądania w dół i w górę - Angle.x = clamp( Angle.x, -M_PI_4, M_PI_4 ); - } - // update position if( ( m_owner == nullptr ) || ( false == Global.ctrlState )