Rotation value 180 always resets to 0?
I have a blueprint actor in my scene. In the level blueprint I have tied 3 inputs to it which change it's rotation. For example, lets say the X, Y and Z keys each add positive 90 degrees to it's local rotation in the X, Y and Z axis respectively.
Here's the rub: Rotating about the X and Z axis works flawlessly, but the Y rotation doesn't. I would expect 4 presses of the same key to rotate a full 360 degrees and return it to it's starting rotation, however the Y axis does not.The blueprint is set up in an identical fashion as the other axis, but after the second execution it resets Y Rotation to 0.
Forgive me if this is hard to explain, I am just at a loss as to why 1 axis is behaving differently from the other two. Any help would be appreciated.
asked Oct 04 '16 at 08:16 AM in Blueprint Scripting
So I solved the problem. I apologize if this sounds abstract without screenshots, but here was the issue:
My blueprint network looked a little like this.
[Press Y Key] --> [Get Y Rotation of Actor] --> [Set variable "y_rot"] --> [(Some timeline lerp nodes to control the rotation animation, referencing "y_rot")] --> [Set actor Y rotation to 'y_rot'] --> [Set 'y_rot' variable to new y rotation of actor]
I did some debugging by adding two [Print String] instructions to two different inputs. One of them printed the rotation value of my actor, and the other input printed the float value in my "y_rot" variable. In theory, they should always be the same. I then changed the increment of my rotation command to 20 degrees (down from 90). So each execution would increase the rotation on the Y axis from 0 to 20, 20 to 40, etc.
I found that once this value exceeded 90 it would "invert" the value (for lack of the proper math term). So I would press the Y key to advance the rotation from 80 to 100, and after that my two [Print Strings] would disagree: one saying 100, the other saying 80. Further presses of Y repeated the same rotation from 80 degrees to 100, over and over.
I removed the first [Set variable "y_rot"] node from my network and it solved the problem.
answered Oct 05 '16 at 01:43 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here