Transform.Translate:
1)功能简述
public void Translate(Vector3 translation, Space relativeTo = Space.Self);
Moves the transform in the direction and distance of translation.
If relativeTo is left out or set to Space.Self the movement is applied relative to the transform's local axes. (the x, y and z axes shown when selecting the object inside the Scene View.) If relativeTo is Space.World the movement is applied relative to the world coordinate system.
2)使用举例
using UnityEngine;
using System.Collections;public class ExampleClass : MonoBehaviour {
void Update() {
transform.Translate(Vector3.forward * Time.deltaTime);
transform.Translate(Vector3.up * Time.deltaTime, Space.World);
}
}