rotation
Returns a random rotation (Read Only).
Read time 1 minuteLast updated 4 days ago
Definition
- Type: Property
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
public static Quaternion rotation { get; }
Remarks
Randomize the , , , and of a Quaternion each to [-1.0..1.0] (inclusive) via Random.Range and normalize the result. See also Random.rotationUniform for a slower but higher quality algorithm.
xyzwExamples
using UnityEngine;// Click the "Rotate!" button and a rotation will be appliedpublic class ExampleClass : MonoBehaviour{ void OnGUI() { if (GUI.Button(new Rect(10, 10, 100, 50), "Rotate!")) { transform.rotation = Random.rotation; } }}