quaternion unity rotation code example
Example 1: unity rotation to quaternion
using UnityEngine;public class Example : MonoBehaviour
{
void Start()
{
// A rotation 30 degrees around the y-axis
Quaternion rotation = Quaternion.Euler(0, 30, 0);
}
}
Example 2: how to chagne rotation in unity
transform.eulerAngles = new Vector3(0f, 180f, 0f); // rotates 180 degrees