Script language:

  • JS
  • C#
  • Boo
Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Suggest a change
Rotate(eulerAngles: Vector3, relativeTo: Space = Space.Self): void;
void Rotate(Vector3 eulerAngles, Space relativeTo = Space.Self);
def Rotate(eulerAngles as Vector3, relativeTo as Space = Space.Self) as void

Description

Applies a rotation of /eulerAngles.z/ degrees around the z axis, /eulerAngles.x/ degrees around the x axis, and /eulerAngles.y/ degrees around the y axis (in that order).

If relativeTo is left out or set to Space.Self the rotation is applied around the transform's local axes. (The x, y and z axes shown when selecting the object inside the Scene View.) If relativeTo is Space.World the rotation is applied around the world x, y, z axes.

	function Update() {
		// Slowly rotate the object around its X axis at 1 degree/second.
		transform.Rotate(Vector3.right * Time.deltaTime);

// ... at the same time as spinning relative to the global // Y axis at the same speed. transform.Rotate(Vector3.up * Time.deltaTime, Space.World); }

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    void Update() {
        transform.Rotate(Vector3.right * Time.deltaTime);
        transform.Rotate(Vector3.up * Time.deltaTime, Space.World);
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	def Update() as void:
		transform.Rotate((Vector3.right * Time.deltaTime))
		transform.Rotate((Vector3.up * Time.deltaTime), Space.World)

Rotate(xAngle: float, yAngle: float, zAngle: float, relativeTo: Space = Space.Self): void;
void Rotate(float xAngle, float yAngle, float zAngle, Space relativeTo = Space.Self);
def Rotate(xAngle as float, yAngle as float, zAngle as float, relativeTo as Space = Space.Self) as void

Description

Applies a rotation of zAngle degrees around the z axis, xAngle degrees around the x axis, and yAngle degrees around the y axis (in that order).

If relativeTo is left out or sot to Space.Self the rotation is applied around the transform's local axes. (The x, y and z axes shown when selecting the object inside the Scene View.) If relativeTo is Space.World the rotation is applied around the world x, y, z axes.

	function Update() {
		// Slowly rotate the object around its X axis at 1 degree/second.
		transform.Rotate(Time.deltaTime, 0, 0);

// ... at the same time as spinning it relative to the global // Y axis at the same speed. transform.Rotate(0, Time.deltaTime, 0, Space.World); }

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    void Update() {
        transform.Rotate(Time.deltaTime, 0, 0);
        transform.Rotate(0, Time.deltaTime, 0, Space.World);
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	def Update() as void:
		transform.Rotate(Time.deltaTime, 0, 0)
		transform.Rotate(0, Time.deltaTime, 0, Space.World)

Rotate(axis: Vector3, angle: float, relativeTo: Space = Space.Self): void;
void Rotate(Vector3 axis, float angle, Space relativeTo = Space.Self);
def Rotate(axis as Vector3, angle as float, relativeTo as Space = Space.Self) as void

Description

Rotates the transform around axis by angle degrees.

If relativeTo is left out or set to Space.Self the axis parameter is relative to the transform's local axes. (The x, y and z axes shown when selecting the object inside the Scene View.) If relativeTo is Space.World the axis parameter is relative to the world x, y, z axes.

	function Update() {
		// Slowly rotate the object around its X axis at 1 degree/second.
		transform.Rotate(Vector3.right, Time.deltaTime);

// ... at the same time as spinning it relative to the global // Y axis at the same speed. transform.Rotate(Vector3.up, Time.deltaTime, Space.World); }

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    void Update() {
        transform.Rotate(Vector3.right, Time.deltaTime);
        transform.Rotate(Vector3.up, Time.deltaTime, Space.World);
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	def Update() as void:
		transform.Rotate(Vector3.right, Time.deltaTime)
		transform.Rotate(Vector3.up, Time.deltaTime, Space.World)

Your name (optional):
Your email (optional):
Please write your suggestion here: