mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-17 23:39:18 +02:00
Limit camera pitch movement to +/- 90°
This commit is contained in:
@@ -167,14 +167,10 @@ void TCamera::Update()
|
|||||||
Angle.y += 2 * M_PI;
|
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 );
|
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
|
// update position
|
||||||
if( ( m_owner == nullptr )
|
if( ( m_owner == nullptr )
|
||||||
|| ( false == Global.ctrlState )
|
|| ( false == Global.ctrlState )
|
||||||
|
|||||||
Reference in New Issue
Block a user