Version: 2017.2
public void Translate (Vector3 translation, Space relativeTo= Space.Self);

Descripción

Mueve el transform en la dirección y distancia de 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.

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); } }

public void Translate (float x, float y, float z, Space relativeTo= Space.Self);

Descripción

Mueve el transform por x a lo largo del eje x, y a lo largo del eje y, y z a lo largo del eje z.

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.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Update() { transform.Translate(0, 0, Time.deltaTime); transform.Translate(0, Time.deltaTime, 0, Space.World); } }

public void Translate (Vector3 translation, Transform relativeTo);

Descripción

Mueve el transform en la dirección y distancia de translation.

The movement is applied relative to relativeTo's local coordinate system. If relativeTo is null, the movement is applied relative to the world coordinate system.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Update() { transform.Translate(Vector3.right * Time.deltaTime, Camera.main.transform); } }

public void Translate (float x, float y, float z, Transform relativeTo);

Descripción

Mueve el transform por x a lo largo del eje x, y a lo largo del eje y, y z a lo largo del eje z.

The movement is applied relative to relativeTo's local coordinate system. If relativeTo is null, the movement is applied relative to the world coordinate system.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Update() { transform.Translate(Time.deltaTime, 0, 0, Camera.main.transform); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961