From 4104ae8df7e4a5e0d502b2c82e1d448fe6affa27 Mon Sep 17 00:00:00 2001 From: Dander7BD Date: Wed, 19 Feb 2014 15:00:28 +0100 Subject: [PATCH] Camera_FPSV2 fix + Added bug trap Camera_FPSV2::SetRotation Though it caught no bugs --- Code/Game/GameClient/GameClientState/Camera_FPSV2.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Code/Game/GameClient/GameClientState/Camera_FPSV2.cpp b/Code/Game/GameClient/GameClientState/Camera_FPSV2.cpp index 12506d3c..3af0cae5 100644 --- a/Code/Game/GameClient/GameClientState/Camera_FPSV2.cpp +++ b/Code/Game/GameClient/GameClientState/Camera_FPSV2.cpp @@ -38,8 +38,13 @@ void Camera_FPSV2::SetPosition( const Float3 &translation ) void Camera_FPSV2::SetRotation( const Quaternion &rotation ) { + if( !Within(rotation.GetNorm(), .99f, 1.01f) ) + { // HACK: bug trap + const char *breakPoint = "Caught an invalid rotation!"; + } + this->body.rotation = rotation; - this->head.SetRotation( rotation * Rotation(this->pitchUp, this->GetNormalOf(Float3::standard_unit_x) ) ); + this->head.SetRotation( rotation * Rotation(this->pitchUp, WorldAxisOf(rotation, Float3::standard_unit_x) ) ); } void Camera_FPSV2::SetAngular( const Float3 &axis ) @@ -116,7 +121,7 @@ void Camera_FPSV2::StrafeLeft( Float distance ) void Camera_FPSV2::PitchUp( Float radian ) { this->pitchUp = Clamp( this->pitchUp + radian, -0.48f * pi, 0.48f * pi ); - this->head.SetRotation( this->body.rotation * Rotation(this->pitchUp, Float3::standard_unit_x) ); +// this->head.SetRotation( this->body.rotation * Rotation(this->pitchUp, Float3::standard_unit_x) ); } void Camera_FPSV2::PitchDown( Float radian )