Adde default value to _HeadPitch. Change bounds

merge-requests/27/head
Nuno 3 years ago
parent a246f3e5d0
commit 5c56c87d09

@ -186,7 +186,7 @@ CUserEntity::CUserEntity()
_MoveToAction= CUserEntity::None;
_MoveToDist= 0.0;
_MoveToColStartTime= 0;
_HeadPitch = Pi/2;
_FollowForceHeadPitch= false;
_ForceLookSlot= CLFECOMMON::INVALID_SLOT;
@ -2552,9 +2552,9 @@ void CUserEntity::rotHeadVertically(float ang)
//-----------------------------------------------
void CUserEntity::setHeadPitch(double hp)
{
_HeadPitch= hp;
const double bound= Pi/2 - 0.01; // epsilon to avoid gimbal lock
clamp(_HeadPitch, -bound, bound);
_HeadPitch = hp;
// epsilon to avoid gimbal lock
clamp(_HeadPitch, -Pi/2 + 0.01, Pi/2 - 0.5);
}
//---------------------------------------------------

Loading…
Cancel
Save