unity rotate around point code example
Example 1: rotate vector3 around pivot point unity
public Vector3 RotatePointAroundPivot(Vector3 point, Vector3 pivot, Vector3 angles) { return Quaternion.Euler(angles) * (point - pivot) + pivot; }
Example 2: unity rotate towards
Quaternion.RotateTowards(Quaternion from, Quaternion to, float maxDegreesDelta);
Example 3: unity rotate around axis
transform.Rotate(axis, degrees);
Example 4: unity rotate around point
transform.RotateAround(point, axis, degrees);
Example 5: unity rotate quaternion around axis
RoatationVar = Quaternion.Euler(Vector3.up) * camera.rotation;
Example 6: unity rotate vector around point
Vector3 rotated = Quaternion.AngleAxis(-45, Vector3.up) * vector;