# Dealing with Rotations

First of all, Vector3 is a data type, and doesn’t imply which type of data it is. It can be a position:

``````var place : Vector3 = Vector3(10.0, 13.5, 101.2);
transform.position = place;
``````

or it can be a rotation in degrees:

``````var angleDirection : Vector3 = Vector3(0, 180, 270);
transform.rotation.eulerAngles = angleDirection;
``````

//or it can be a rotation as a euler:

``````var eulerDirection : Vector3 = Vector3(0.12, 0.35, 0.8734);
transform.rotation = Quaternion.Euler(eulerDirection);
``````

All rotations are stored as Quaternions but we want to deal with them as Eulers or degree rotations, so we need to convert them back and forth.

Quaternion to Angle in Degrees:

``````var degreeAngle : Vector3 = transform.rotation.eulerAngles;
Debug.Log("degreeAngle = "+degreeAngle);
``````

degreeAngle = (0.0, 157.6, 0.0)

This is as far as I’ve gotten. The other conversions I need to know are:

Euler to Degrees
Degrees to Euler
Quaternion to Euler
Euler to Quaternion

Does anyone have this on the tip of their tongue and could let me know?

Hrrm, now I’m confused, I thought Euler angles were in degrees, not radians.

:twisted:

Eulers are very confusing. This link explains what they actually are:

This is why conversion is so important! This is MUST KNOW material!

I’m familiar with Euler angles, where you lost me is how they’re different to rotating something by degrees?

``````var eulerDirection : Vector3 = Vector3(0.12, 0.35, 0.8734);
``````var eulerDirection : Vector3 = Vector3(0, 180, 270);