The rotation as Euler angles in degrees.
The x, y, and z angles represent a rotation z degrees around the z axis, x degrees around the x axis, and y degrees around the y axis (in that order).
Only use this variable to read and set the angles to absolute values. Don't increment them, as it will fail when the angle exceeds 360 degrees. Use Transform.Rotate instead.
// Print the rotation around the global X Axis
print (transform.eulerAngles.x);
// Print the rotation around the global Y Axis
print (transform.eulerAngles.y);
// Print the rotation around the global Z Axis
print (transform.eulerAngles.z);
// Assign an absolute rotation using eulerAngles
var yRotation : float = 5.0;
function Update () {
yRotation += Input.GetAxis("Horizontal");
transform.eulerAngles = Vector3(10, yRotation, 0);
}
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public float yRotation = 5.0F;
void Update() {
yRotation += Input.GetAxis("Horizontal");
transform.eulerAngles = new Vector3(10, yRotation, 0);
}
void Example() {
print(transform.eulerAngles.x);
print(transform.eulerAngles.y);
print(transform.eulerAngles.z);
}
}
import UnityEngine
import System.Collections
class example(MonoBehaviour):
public yRotation as single = 5.0F
def Update():
yRotation += Input.GetAxis('Horizontal')
transform.eulerAngles = Vector3(10, yRotation, 0)
def Example():
print(transform.eulerAngles.x)
print(transform.eulerAngles.y)
print(transform.eulerAngles.z)