rotate around custom pivot unity code example
Example 1: unity rotate around pivot c#
public Transform customPivot;
void Update()
{
transform.RotateAround(customPivot.position, Vector3.up, 20 * Time.deltaTime);
}
Example 2: rotate vector3 around pivot point unity
public Vector3 RotatePointAroundPivot(Vector3 point, Vector3 pivot, Vector3 angles) { return Quaternion.Euler(angles) * (point - pivot) + pivot; }