I am trying to limit Camera Pitch Scale in according to character pose state.
Implementation in bp is working fine, but in C++ the character is always looking to the sky.
C++ version:
//If the limit is currently exceeded, set the boundary value
if (!(GetControlRotation().Pitch > LocBottomValue) || !(GetControlRotation().Pitch < LocTopValue))
{
if ((abs(rot.Pitch - LocTopValue)) < (abs(rot.Pitch - LocBottomValue)))
{
FRotator rot = GetControlRotation();
rot.Pitch = LocTopValue;
MyControllerRef->SetControlRotation (rot);
}
else
{
FRotator rot = GetControlRotation();
rot.Pitch = LocBottomValue;
MyControllerRef->SetControlRotation(rot);
}
}
