float angle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward);
unity3d学习笔记 使得一个物体的旋转(rotation)到和(自己与另一个物体的方向平行)
最新推荐文章于 2023-08-24 19:45:42 发布
float angle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward);