Hopefully a simple solution that I just am over thinking.
Problem: Have a component in the player pawn which rotates using its pitch based on axis input. When pitch value (float) reaches 90, the axis input remains positive but the rotation value attempts to do lower in value (89), causing the value to get stuck in a loop at 90.
e.g. press “up” adding axis value of 1 to world location pitch. world location = 90 + 1 = attempts to become 89. 89 + 1 = 90.
the same happens when using a negative axis input “down”. -90 -1 = world rotation becomes -89
Why is the engine trying to go negative at 90 instead of at 180? Why does the same exact set up work for the separate axis inputs I have set up for lateral movements along the yaw rotation?
The values never go above 95 and never below -95 - unlike the yaw values which go from 0 to 180 to -180 to 0.
how can I get around this lock?
I’ve attempted to add the pitch value to 360 then use (%360), which returns as though it is using a 0-360 scale, but I still experience a lock when the component rotates to its “poles”.
Any help would be greatly appreciated.
I’m confused and could really use help.