Conversion of angles Quaternion <--> Euler

I think someone is going to have a good laugh here.

I don’t understand the first thing about 3d rotation and need to understand how to convert, Euler to Quaternion and inverse.

As below code will show you I am clueless as to what i am doing (wrong) :slight_smile:

Any help?

Player.transform.position = new Vector3(5,5,5);
            Player.transform.Rotate(new Vector3(0.1f,0.2f,0.3f));
            SelectedObject.transform.position = new Vector3(0,0,5);

            //this ray is perfect
            Vector3 wantedheading = (SelectedObject.transform.position - Player.transform.position).normalized;
            Debug.DrawRay(Statics.Player.transform.position, wantedheading * 100, Color.yellow);

            //this ray points in the revese direction
            Quaternion qwanted = Quaternion.Euler(wantedheading);
            Debug.DrawRay(Player.transform.position, qwanted.eulerAngles * 100, Color.blue);

            //I don't even understand where this is pointing :)
            Debug.DrawRay(Player.transform.position, qwanted * Vector3.forward * 100, Color.white);

            //this ray is perfect
            Quaternion qcurent = Player.transform.rotation;
            Debug.DrawRay(Player.transform.position, qcurent * Vector3.forward * 100, Color.red);

            //this ray flips arround in whatever direction it wants :)
            Vector3 curentheading = Player.transform.rotation.eulerAngles.normalized;
            Debug.DrawRay(Player.transform.position, curentheading * 100, Color.green);

Please someone point out what i am doing right, that will be shorter than what I am doing wrong :slight_smile:

From the code, I can’t tell what’s going wrong. You have lines in there that do the conversions for you, so I’m not sure what information you’d like.

Quaternion quatFromEuler = Quaternion.Euler(new Vector3(xDegrees, yDegrees, zDegrees));

Vector3 eulerFromQuat = someQuaternion.eulerAngles;

What do you want these rays to be doing?