For some reason, when I try to rotate an object on the X Axis, for some reason it always reach 90 degree, then start to count backwards and reset the Y and Z to 180
if I try to start at 100, its automatically start from 80, and count backwards (and reset the Y and Z to 180)
I have been trying to play around with this for a few hours now and I cant seems to make it work normally
the ONLY script attached to the GameObject
using UnityEngine;
using System.Collections;
public class Testing : MonoBehaviour {
void Update(){
transform.Rotate(new Vector3(20*Time.deltaTime, 0, 0));
}
}
There are multiple euler angle representations for any given physical representation. Unity stores rotations internally as Quaternions and derives the euler angle values from the Quaternion. Try this:
You will get (0, 180, 180), which is the same physical rotation but a different euler representation. I’m not sure where you are headed with your code, but if you need to read the ‘x’ rotation, it is best to use your own variable and then apply that variable to the rotation rather than attempting to read from transform.eulerAngles. Then you can read the value from your own personal value.
I am trying to set an event to happen when an object is at some degree, but the script that checks he degrees is not the same one who rotates it, so I need to access it from the Transform of the object. Its really odd bug :\ no way around it?
thank you! I ended up exposing my own vector3 as public and accessing it from the other script, it works fine as a workaround But I think Unity should really take care of that issue Thanks again!!
A fix in Unity is never going to happen. The issue is inherit in the use of Quaternions as the architecture for rotations. Euler-angle-based rotations have their own set of problems including [gimble lock][1]. [1]: http://en.wikipedia.org/wiki/Gimbal_lock
I am trying to set an event to happen when an object is at some degree, but the script that checks he degrees is not the same one who rotates it, so I need to access it from the Transform of the object. Its really odd bug :\ no way around it?
– iPicklethank you! I ended up exposing my own vector3 as public and accessing it from the other script, it works fine as a workaround But I think Unity should really take care of that issue Thanks again!!
– iPickleA fix in Unity is never going to happen. The issue is inherit in the use of Quaternions as the architecture for rotations. Euler-angle-based rotations have their own set of problems including [gimble lock][1]. [1]: http://en.wikipedia.org/wiki/Gimbal_lock
– robertbu