如何让物体旋转度数?统一
How to get an objects rotation in degrees? Unity
当我 运行 这样做时:
Debug.Log(playerCenter.transform.rotation);
它给出了具有四个值的结果。这些值中的每一个都在 -1 和 1 之间。我如何才能获得以度为单位的 x y 和 z 值。
还有第四个值是多少?
你试过playerCenter.transform.rotation.eulerAngle
了吗?或者 playerCenter.transform.eulerAngle
。另外关于第四个值,你指的是Quaternion
的第四个参数吗?例如Quaternion (float x, float y, float z, float w)
?
尝试使用 transform.eulerAngles
, transform.rotation returns a Quaternion that is normalized. Also a quaternion returns 4 values. The first value you are getting is the rotation around the other vector(the other 3 values). 、So you could think of it as the rotation of the rotation, in simple terms!
当我 运行 这样做时: Debug.Log(playerCenter.transform.rotation); 它给出了具有四个值的结果。这些值中的每一个都在 -1 和 1 之间。我如何才能获得以度为单位的 x y 和 z 值。
还有第四个值是多少?
你试过playerCenter.transform.rotation.eulerAngle
了吗?或者 playerCenter.transform.eulerAngle
。另外关于第四个值,你指的是Quaternion
的第四个参数吗?例如Quaternion (float x, float y, float z, float w)
?
尝试使用 transform.eulerAngles
, transform.rotation returns a Quaternion that is normalized. Also a quaternion returns 4 values. The first value you are getting is the rotation around the other vector(the other 3 values). So you could think of it as the rotation of the rotation, in simple terms!