unity Transform 的 Rotate(xAngle: float, yAngle: float, zAngle: float, relativeTo: Space = Space.Self, Space.World); 刨根问底
public class demoword2 : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
//transform.Rotate(60, 70, 80, Space.World);
//eulerAngles.z度围绕z轴,eulerAngles.x度围绕x轴,eulerAngles.y度围绕y轴
//unity Inspector 面板上的rotation旋转:XYZ 是 相对于父坐标的旋转值
//一次旋转一个轴: zxy 世界坐标 《====》 yxz (本地坐标顺序)
//一次旋转三个轴:transform.Rotate(x, y, z, Space.World) 他可以才分为 先旋转z轴,再x轴,再y轴 等价
transform.Rotate(0, 0, 80, Space.World);
transform.Rotate(60, 0, 0, Space.World);
transform.Rotate(0, 70, 0, Space.World);
}
// Update is called once per frame
void Update()
{
//transform.Rotate(10 * Time.deltaTime, 20 * Time.deltaTime, 30 * Time.deltaTime, Space.World);
}
}
unity 这种旋转方式很特别,刨根问底....
说明:godot 没有这样的旋转方法,只有类似 void rotate ( Vector3 axis, float angle ) 围绕轴(单位 Vector3)旋转局部变换,指定角度(弧度)。
浙公网安备 33010602011771号