Suggest a change
Success!
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
Close
Sumbission failed
For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
Close
Switch to Manual
public function
Translate(
translation:
Vector3,
relativeTo:
Space = Space.Self):
void;
public void
Translate(
Vector3 translation,
Space relativeTo = Space.Self);
public
def
Translate(
translation as
Vector3,
relativeTo as
Space = Space.Self)
as void
Description
/translation/ の方向と距離に移動します
/relativeTo/ を設定しない、またはSpace.Selfを設定した場合は、移動はTransformのローカル軸で適用されます。(シーンビュー内でオブジェクトを選択している時に見えているX,Y,Z軸)
/relativeTo/ がSpace.Worldの場合、移動はワールド座標を基準に適用されます。
public function
Translate(
x:
float,
y: float,
z: float,
relativeTo:
Space = Space.Self):
void;
public void
Translate(float
x,
float
y,
float
z,
Space relativeTo = Space.Self);
public
def
Translate(
x as float,
y as float,
z as float,
relativeTo as
Space = Space.Self)
as void
Description
Moves the transform by x
along the x axis, y
along the y axis, and z
along the z axis.
/relativeTo/ を設定しない、またはSpace.Selfを設定した場合は、移動はTransformのローカル軸で適用されます。(シーンビュー内でオブジェクトを選択している時に見えているX,Y,Z軸)
/relativeTo/ がSpace.Worldの場合、移動はワールド座標を基準に適用されます。
function 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);
}
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);
}
}
import UnityEngine
import System.Collections
public class ExampleClass(MonoBehaviour):
def Update() as void:
transform.Translate(0, 0, Time.deltaTime)
transform.Translate(0, Time.deltaTime, 0, Space.World)
Description
/translation/ の方向と距離に移動します
The movement is applied relative to /relativeTo/'s local coordinate system.
/relativeTo/ がnullの場合、移動はワールド座標を基準に適用されます。
function Update() {
// Move the object to the right relative to the camera 1 unit/second.
transform.Translate(Vector3.right * Time.deltaTime, Camera.main.transform);
}
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour {
void Update() {
transform.Translate(Vector3.right * Time.deltaTime, Camera.main.transform);
}
}
import UnityEngine
import System.Collections
public class ExampleClass(MonoBehaviour):
def Update() as void:
transform.Translate((Vector3.right * Time.deltaTime), Camera.main.transform)
public function
Translate(
x:
float,
y: float,
z: float,
relativeTo:
Transform):
void;
public void
Translate(float
x,
float
y,
float
z,
Transform relativeTo);
public
def
Translate(
x as float,
y as float,
z as float,
relativeTo as
Transform)
as void
Description
Moves the transform by x
along the x axis, y
along the y axis, and z
along the z axis.
移動は relativeTo
のローカル座標を基準に適用されます。
/relativeTo/ がnullの場合、移動はワールド座標を基準に適用されます。
function Update() {
// Move the object to the right relative to the camera 1 unit/second.
transform.Translate(Time.deltaTime, 0, 0, Camera.main.transform);
}
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour {
void Update() {
transform.Translate(Time.deltaTime, 0, 0, Camera.main.transform);
}
}
import UnityEngine
import System.Collections
public class ExampleClass(MonoBehaviour):
def Update() as void:
transform.Translate(Time.deltaTime, 0, 0, Camera.main.transform)