英文原本地址:http://docs.unity3d.com/ScriptReference/Transform.html
Transform 变换
Namespace: UnityEngine
Inherits from: Component
Description 描述
Position, rotation and scale of an object.
对象的位置、旋转和缩放。
Every object in a scene has a Transform. It's used to store and manipulate the position, rotation and scale of the object. Every Transform can have a parent, which allows you to apply position, rotation and scale hierarchically. This is the hierarchy seen in the Hierarchy pane. They also support enumerators so you can loop through children using:
场景中的每一个对象都有一个Transform。用于储存并操控物体的位置、旋转和缩放。每一个Transform可以有一个父级,允许你分层次应用位置、旋转和缩放。可以在Hierarchy面板查看层次关系。他们也支持计数器(enumerator),因此你可以使用循环遍历子对象。
JavaScript:
for (var child : Transform in transform)
{
child.position += Vector3.up * 10.0;
}
C#:
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour {
void Example() {
foreach (Transform child in transform) {
child.position += Vector3.up * 10.0F;
}
}
}
See Also: The Component reference, Physics class.
Variables 变量
The number of children the Transform has. 该变换的子对象数量。 | |
The rotation as Euler angles in degrees. 此旋转作为欧拉角度。 | |
The blue axis of the transform in world space. 在世界空间坐标,变换的蓝色轴。也就是z轴。 | |
Has the transform changed since the last time the flag was set to 'false'? 此变换自从上次标识是否被设置为false了? | |
The rotation as Euler angles in degrees relative to the parent transform's rotation. 旋转作为欧拉角度,相对于父级的变换旋转。 | |
Position of the transform relative to the parent transform. 相对于父级的变换的位置。 | |
The rotation of the transform relative to the parent transform's rotation. 该变换的旋转角度相对于父级变换的旋转角度。 | |
The scale of the transform relative to the parent. 相对于父级变换的缩放。 | |
Matrix that transforms a point from local space into world space (Read Only). 变换点的矩阵从局部坐标到世界坐标(只读)。 | |
The global scale of the object (Read Only). 该对象的整体缩放(只读)。 | |
The parent of the transform. 该变换的父对象。 | |
The position of the transform in world space. 在世界空间坐标transform的位置。 | |
The red axis of the transform in world space. 在世界坐标空间,变换的红色轴。也就是x轴。 | |
Returns the topmost transform in the hierarchy. 返回最高层级的变换。 | |
The rotation of the transform in world space stored as a Quaternion. 在世界坐标空间,储存为四元数变换的旋转角度。 | |
The green axis of the transform in world space. 在世界坐标空间,变换的绿色轴。也就是Y轴。 | |
Matrix that transforms a point from world space into local space (Read Only). 变换点的矩阵从世界坐标到局部坐标(只读)。 |
Functions 函数
Unparents all children.、 所有子对象解除父子关系。 | |
Finds a child by name and returns it. 通过名字查找子对象并返回它。 | |
Returns a transform child by index. 通过索引返回一个变换的子对象。 | |
Gets the sibling index. 获取该对象的同级索引。 | |
Transforms a direction from world space to local space. The opposite of Transform.TransformDirection. 变换的方向从世界坐标转换到局部坐标。和Transform.TransformDirection相反。 | |
Transforms position from world space to local space. The opposite of Transform.TransformPoint. 变换位置从世界坐标到局部坐标。和Transform.TransformPoint相反。 | |
Transforms a vector from world space to local space. The opposite of Transform.TransformVector. 变换一个向量从世界坐标空间到局部坐标空间。这个操作与Transform.TransformVector相反。 | |
Is this transform a child of /parent/? 这个变换是parent的子对象? | |
Rotates the transform so the forward vector points at /target/'s current position. 旋转此变换,让向前向量指向target的当前位置。 | |
Applies a rotation of /eulerAngles.z/ degrees around the z axis, /eulerAngles.x/ degrees around the x axis, and /eulerAngles.y/ degrees around the y axis (in that order). 应用一个欧拉角的旋转角度,eulerAngles.z度围绕z轴,eulerAngles.x度围绕x轴,eulerAngles.y度围绕y轴(这样的顺序)。 | |
Rotates the transform about axis passing through point in world coordinates by angle degrees. 围绕世界坐标的point点的axis旋转该变换angle度。 | |
Move the transform to the start of the local transfrom list. 移动该变换到此局部变换列表的开始。 | |
Move the transform to the end of the local transfrom list. 移动该变换到此局部变换列表的末尾。 | |
Set the parent of the transform. 设置该变换的父级。 | |
Sets the sibling index. 设置同级对象的索引。 | |
Transforms direction from local space to world space. 变换方向从局部坐标转换到世界坐标。 | |
Transforms position from local space to world space. 变换位置从局部坐标到世界坐标。 | |
Transforms vector from local space to world space. \\变换一个向量从局部坐标空间到世界坐标空间。 | |
Moves the transform in the direction and distance of translation. 移动transform在translation的方向和距离。 |