Transform .rotate Unity Code Example
Example 1: how to rotate object unity public Transform Position ; // make reference in inspector Position. Rotate ( x , y , z ) ; Example 2: transform.rotation transform.eulerAngles = new Vector3 ( 0 , 0 , 180 ) ; transform.localEulerAngles = new Vector3 ( 0 , 0 , 180 ) ; transform.eulerAngles = new Vector3 ( 0 , 0 , 180 ) ; transform.localRotation = Quaternion transform.rotation = Quaternion. Euler ( 0 , 0 , 90 ) ; Example 3: unity rotate object c# using UnityEngine ; // Transform.Rotate example // // This script creates two different cubes : one red which is rotated using Space.Self ; one green which is rotated using Space .World . // Add it onto any GameObject in a scene and hit play to see it run. The rotation is controlled using xAngle , yAngle and zAngle , modifiable on the inspector .public class ExampleScript : MonoBehaviour { public float xAngle , yAngle , zAngle ; private GameObject cube1 , cube2 ; void Awake ( ) { cube1 = GameObje