| relativeTo | 旋转相对于对象或世界。 |
| eulers | 要应用的旋转。 |
应用一个围绕 Z 轴旋转 eulerAngles.z 度、围绕 X 轴旋转 eulerAngles.x 度、围绕 Y 轴旋转 eulerAngles.y 度(按此顺序)的旋转。
如果未指定 relativeTo 或将其设置为 Space.Self,则围绕变换的本地轴应用旋转。
如果 relativeTo 设置为 Space.World,则围绕世界空间的 X、Y、Z 轴应用旋转。
using UnityEngine;
public class ExampleClass : MonoBehaviour { void Update() { // Rotate the object around its local X axis at 1 degree per second transform.Rotate(Vector3.right * Time.deltaTime);
// ...also rotate around the World's Y axis transform.Rotate(Vector3.up * Time.deltaTime, Space.World); } }
| xAngle | 围绕 X 轴旋转的度数。 |
| yAngle | 围绕 Y 轴旋转的度数。 |
| zAngle | 围绕 Z 轴旋转的度数。 |
| relativeTo | 旋转相对于对象或世界。 |
应用一个围绕 Z 轴旋转 zAngle 度、围绕 X 轴旋转 xAngle 度、围绕 Y 轴旋转 yAngle 度(按此顺序)的旋转。
如果未指定 relativeTo 或将其设置为 Space.Self,则围绕变换的本地轴应用旋转。
如果 relativeTo 设置为 Space.World,则围绕世界空间的 X、Y、Z 轴应用旋转。
using UnityEngine;
public class ExampleClass : MonoBehaviour { void Update() { // Rotate the object around its local X axis at 1 degree per second transform.Rotate(Time.deltaTime, 0, 0);
// ...also rotate around the World's Y axis transform.Rotate(0, Time.deltaTime, 0, Space.World); } }
| axis | 要应用旋转的轴。 |
| angle | 要应用的旋转度数。 |
| relativeTo | 旋转相对于对象或世界。 |
将对象围绕 axis 旋转 angle 度。
如果未指定 relativeTo 或将其设置为 Space.Self,则围绕变换的本地轴应用旋转。
如果 relativeTo 设置为 Space.World,则围绕世界空间的 X、Y、Z 轴应用旋转。
using UnityEngine;
public class ExampleClass : MonoBehaviour { void Update() { // Rotate the object around its local X axis at 1 degree per second transform.Rotate(Vector3.right, Time.deltaTime);
// ...also rotate around the World's Y axis transform.Rotate(Vector3.up, Time.deltaTime, Space.World); } }