Something seriously weird is going on with my transform.eulerAngles
In the inspector for a gameObject I'm using the starting rotation is "-90", but when I run print(transform.eulerAngles.x) I get 270 (ditto for transform.localEulerAngles.x).
If I tilt the gameObject downward, the inspector X value gets bigger (say, to -85) as it should. The printed transform.eulerAngles.x also gets bigger, say to 274.
Here's where things get weird:
If I tilt the gameObject upward the inspector x coordinate gets smaller (ex, to -95), as it should, BUT the printed eulerAngle.x value gets BIGGER (here to 274). So if I rotate the object up or down from the eulerAngle.x being 270, the x value increases regardless.
I'm definitely doing something wrong here, but after a lot of troubleshooting I still can't figure out what. Any thoughts?
Are all your other components (y, z) remaining the same? for example, rotate an object to (90, -90, 0), now rotating eitherway on the Z axis will reduce the 'x' value of the rotation, (60, -270, -180) points to one side of the split and (60, -90, 0) points the otherside. It is most likely simply a consequence of the backend using quaternion orientations!
Your answer
Follow this Question
Related Questions
How to make a 2D sprite rotate towards a specific point while facing perpendicular to the camera ? 1 Answer
Draw a ray from a gamobject and keep direction of the ray relative to the gameobjects rotation. 1 Answer
Quaternion Rotation - AngleAxis/EulerAngle 2 Answers
How to add to a rotation angle? 0 Answers