// 旋转轴
Vector3 axis = Vector3.up;
// 旋转弧度
float rad = 50f * Mathf.Deg2Rad;
Quaternion quaternion = new Quaternion();
quaternion.x = Mathf.Sin(rad / 2f) * axis.x;
quaternion.y = Mathf.Sin(rad / 2f) * axis.y;
quaternion.z = Mathf.Sin(rad / 2f) * axis.z;
quaternion.w = Mathf.Cos(rad / 2f);
transform.rotation = quaternion;
// 相当于
//transform.rotation = Quaternion.Euler(0f, 50f, 0f);
标签:rad,Mathf,四元,unity,2f,quaternion,Sin,计算方法,axis
From: https://www.cnblogs.com/kingBook/p/17121163.html