quartenion rotation 2d unity code example
Example 1: unity rotation to quaternion
using UnityEngine;public class Example : MonoBehaviour
{
void Start()
{
Quaternion rotation = Quaternion.Euler(0, 30, 0);
}
}
Example 2: rotation unity script 2d
transform.eulerAngles = Vector3.forward * degrees;
transform.rotation = Quaternion.Euler(Vector3.forward * degrees);
transform.rotation = Quaternion.LookRotation(Vector3.forward, yAxisDirection);
transform.LookAt(Vector3.forward, yAxisDirection);
transform.right = xAxisDirection;
transform.up = yAxisDirection;
Example 3: rotation unity script 2d
transform.Rotate(Vector3(0, 0, 50));
transform.eulerAngles = new Vector3 (0, 0, 50);
transform.eulerAngles = Vector3.forward * 50;