Unity - Scripting API - Transform - Rotate
Unity - Scripting API - Transform - Rotate
Rotate
unity.com
Search scripting...
TextGenerator
TextMesh
Texture
Manual Transform.Rotate
Scripting API
Leave feedback
Texture2D
Version: 2020.3 C#
Texture2DArray SWITCH TO MANUAL
Texture3D
Time
Description
Touch
Use Transform.Rotate to rotate GameObjects in a
TouchScreenKeyboard
variety of ways. The rotation is often provided as
TrailRenderer an Euler angle and not a Quaternion.
Transform
You can specify a rotation in world axes or local
Tree
axes.
TreeInstance
TreePrototype World axis rotation uses the coordinate system of
UICharInfo the Scene , so when you start rotate a GameObject,
its x, y, and z axes are aligned with the x, y, and z
UILineInfo
world axes. So if you rotate a cube in world space,
UIVertex its axes align with the world. When you select a
Vector2 cube in the Unity Editor’s Scene view, rotation
Vector2Int Gizmos appear for the left/right, up/down and
forward/back rotation axes. Moving these Gizmos
Vector3
rotates the cube around the axes. If you de-select
Vector3Int and then re-select the cube, the axes restart in
Vector4 world alignment.
WaitForEndOfFrame
Local rotation uses the coordinate system of the
WaitForFixedUpdate
GameObject itself. So, a newly created cube uses
WaitForSeconds its x, y, and z axis set to zero rotation. Rotating the
cube updates the rotation axes. If you de-select
and the re-select the cube, the axes are shown in
the same orientation as before.
https://docs.unity3d.com/ScriptReference/Transform.Rotate.html 1/7
30/8/2021 Unity - Scripting API: Transform.Rotate
unity.com
Search scripting...
TextGenerator
TextMesh Manual Scripting API
Texture
Texture2D
Version: 2020.3 C#
A cube rotated in Local Gizmo Toggle
Texture2DArray
Texture3D
Time
Touch
TouchScreenKeyboard
TrailRenderer
Transform
Tree
TreeInstance A cube not rotated in Global Gizmo Toggle
TreePrototype
UICharInfo
UILineInfo
UIVertex
Vector2
Vector2Int
Vector3
Vector3Int
A cube rotated in Global Gizmo Toggle
Vector4
WaitForEndOfFrame
WaitForFixedUpdate For more information on Rotation in Unity, see
WaitForSeconds Rotation and Orientation in Unity.
Declaration
public void Rotate(Vector3 eulers,
Space relativeTo
= Space.Self);
Parameters
eulers The rotation to apply in euler
angles.
https://docs.unity3d.com/ScriptReference/Transform.Rotate.html 2/7
30/8/2021 Unity - Scripting API: Transform.Rotate
Description
The implementation of this method 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).
Touch
TouchScreenKeyboard // Transform.Rotate example
TrailRenderer //
UILineInfo
private GameObject cube1, cube2;
UIVertex
Vector2 void Awake()
Vector2Int {
cube1 = GameObject.CreatePri
Vector3
cube1.transform.position = n
Vector3Int
cube1.transform.Rotate(90.0f
Vector4 cube1.GetComponent<Renderer>
WaitForEndOfFrame cube1.name = "Self";
WaitForFixedUpdate
cube2 = GameObject.CreatePri
WaitForSeconds
cube2.transform.position = n
cube2.transform.Rotate(90.0f
cube2.GetComponent<Renderer>
cube2.name = "World";
void Update()
cube1.transform.Rotate(xAngl
cube2.transform.Rotate(xAngl
}
https://docs.unity3d.com/ScriptReference/Transform.Rotate.html 4/7
30/8/2021 Unity - Scripting API: Transform.Rotate
unity.com
Declaration
Search scripting... public void Rotate(Vector3 axis,
float angle,
Space
TextGenerator relativeTo = Space.Self);
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).
Declaration
https://docs.unity3d.com/ScriptReference/Transform.Rotate.html 5/7
30/8/2021 Unity - Scripting API: Transform.Rotate
Search scripting...
TextGenerator
Parameters
TextMesh Manual xAngle
ScriptingDegrees
API to rotate the GameObject
Texture around the X axis.
Texture2D
Version: 2020.3 yAngle Degrees to rotate the GameObject C#
Texture2DArray around the Y axis.
WaitForSeconds
Description
Rotates the object around the given axis by the
number of degrees defined by the given angle.
https://docs.unity3d.com/ScriptReference/Transform.Rotate.html 6/7
30/8/2021 Unity - Scripting API: Transform.Rotate
Search scripting...
TextGenerator
TextMesh Manual Scripting API
Texture
Texture2D
Version: 2020.3 Is something described here not working as you expect it to?C#
It
Texture2DArray
might be a Known Issue. Please check with the Issue Tracker
Texture3D
Time at issuetracker.unity3d.com .
Touch
TouchScreenKeyboard Copyright ©2021 Unity Technologies. Publication Date:
TrailRenderer
Transform 2021-08-23.
Tree
Tutorials
Community Answers
Knowledge
TreeInstance
TreePrototype Base
Forums
Asset Store
UICharInfo
UILineInfo
UIVertex
Vector2
Vector2Int
Vector3
Vector3Int
Vector4
WaitForEndOfFrame
WaitForFixedUpdate
WaitForSeconds
https://docs.unity3d.com/ScriptReference/Transform.Rotate.html 7/7