Pitch Rotation stucks at [-90 90] C++
I searched all relative questions on this topic and i couldn't find something useful. I use 4.15 and the pitch rotation bug is still there. My problem is not Gimbal Lock . My Actor just stops pitch rotating at (-)90 degrees. I tried SetActorLocation, LocalRotation,SetWorldRotation,SetActorRelativeLocation and every time i get the same result. I even tried quaternions.
asked Apr 22 '17 at 05:56 PM in C++ Programming
The solution to my problem was:
Had to remove
The quaternion part is not necessary .
answered Apr 29 '17 at 03:58 PM
I looked a bit in the source code and saw, that the rotator is eventually turned into a quaternion. So when you call GetActorRotation, this quaternion is transformed back into a rotator, but because of mathematical reason I don't understand, the pitch angle is clamped between -90 and 90 degree.
(Yaw and roll seem to be calculated with an atan2, which ranges from -180 to 180 degree, and pitch seem to be calculated with an asin, which results in a range from -90 to 90 degree. But again, I have no understanding about the mathematical reasons why to use asin and atan2.)
In the source code I could find references to this quaternion-to-rotator-transformation, perhaps they are helpful for you. And the function is question is
answered Apr 23 '17 at 07:46 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here