Transform.Translate 平移
function Translate (translation : Space = Space.Self) : void
Description描述
Moves the transform in the direction and distance of translation.
移动transform在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.
如果relativeTo留空或者设置为Space.Self,移动被应用相对于变换的自身轴。(当在场景视图选择物体时,x、y和z轴显示)如果相对于Space.World 移动被应用相对于世界坐标系统。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
void Update() {
transform.Translate(Vector3.forward * Time.deltaTime);
transform.Translate(Vector3.up * Time.deltaTime, Spa