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() { // Move the object forward along its z axis 1 unit/second. transform.Translate(Vector3.forward * Time.deltaTime);
// Move the object upward in world space 1 unit/second. transform.Translate(Vector3.up * Time.deltaTime, Space.World); } }
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() { // Move the object forward along its z axis 1 unit/second. transform.Translate(0, 0, Time.deltaTime);
// Move the object upward in world space 1 unit/second. transform.Translate(0, Time.deltaTime, 0, Space.World); } }
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() { // Move the object to the right relative to the camera 1 unit/second. transform.Translate(Vector3.right * Time.deltaTime, Camera.main.transform); } }
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() { // Move the object to the right relative to the camera 1 unit/second. transform.Translate(Time.deltaTime, 0, 0, Camera.main.transform); } }