用户工具

站点工具


侧边栏



Unity3D中文文档

script:unityengine:classes:transform:transform

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 变量

childCountThe number of children the Transform has.
该变换的子对象数量。
eulerAnglesThe rotation as Euler angles in degrees.
此旋转作为欧拉角度。
forwardThe blue axis of the transform in world space.
在世界空间坐标,变换的蓝色轴。也就是z轴。
hasChangedHas the transform changed since the last time the flag was set to 'false'?
此变换自从上次标识是否被设置为false了?
localEulerAnglesThe rotation as Euler angles in degrees relative to the parent transform's rotation.
旋转作为欧拉角度,相对于父级的变换旋转。
localPositionPosition of the transform relative to the parent transform.
相对于父级的变换的位置。
localRotationThe rotation of the transform relative to the parent transform's rotation.
该变换的旋转角度相对于父级变换的旋转角度。
localScaleThe scale of the transform relative to the parent.
相对于父级变换的缩放。
localToWorldMatrixMatrix that transforms a point from local space into world space (Read Only).
变换点的矩阵从局部坐标到世界坐标(只读)。
lossyScaleThe global scale of the object (Read Only).
该对象的整体缩放(只读)。
parentThe parent of the transform.
该变换的父对象。
positionThe position of the transform in world space.
在世界空间坐标transform的位置。
rightThe red axis of the transform in world space.
在世界坐标空间,变换的红色轴。也就是x轴。
rootReturns the topmost transform in the hierarchy.
返回最高层级的变换。
rotationThe rotation of the transform in world space stored as a Quaternion.
在世界坐标空间,储存为四元数变换的旋转角度。
upThe green axis of the transform in world space.
在世界坐标空间,变换的绿色轴。也就是Y轴。
worldToLocalMatrixMatrix that transforms a point from world space into local space (Read Only).
变换点的矩阵从世界坐标到局部坐标(只读)。

Functions 函数

DetachChildrenUnparents all children.、
所有子对象解除父子关系。
FindFinds a child by name and returns it.
通过名字查找子对象并返回它。
GetChildReturns a transform child by index.
通过索引返回一个变换的子对象。
GetSiblingIndexGets the sibling index.
获取该对象的同级索引。
InverseTransformDirectionTransforms a direction from world space to local space. The opposite of Transform.TransformDirection.
变换的方向从世界坐标转换到局部坐标。和Transform.TransformDirection相反。
InverseTransformPointTransforms position from world space to local space. The opposite of Transform.TransformPoint.
变换位置从世界坐标到局部坐标。和Transform.TransformPoint相反。
InverseTransformVectorTransforms a vector from world space to local space. The opposite of Transform.TransformVector.
变换一个向量从世界坐标空间到局部坐标空间。这个操作与Transform.TransformVector相反。
IsChildOfIs this transform a child of /parent/?
这个变换是parent的子对象?
LookAtRotates the transform so the forward vector points at /target/'s current position.
旋转此变换,让向前向量指向target的当前位置。(照相机的视口对准目标)
RotateApplies 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轴(这样的顺序)。
RotateAroundRotates the transform about axis passing through point in world coordinates by angle degrees.
围绕世界坐标的point点的axis旋转该变换angle度。
SetAsFirstSiblingMove the transform to the start of the local transfrom list.
移动该变换到此局部变换列表的开始。
SetAsLastSiblingMove the transform to the end of the local transfrom list.
移动该变换到此局部变换列表的末尾。
SetParentSet the parent of the transform.
设置该变换的父级。
SetSiblingIndexSets the sibling index.
设置同级对象的索引。
TransformDirectionTransforms direction from local space to world space.
变换方向从局部坐标转换到世界坐标。
TransformPointTransforms position from local space to world space.
变换位置从局部坐标到世界坐标。
TransformVectorTransforms vector from local space to world space. \\变换一个向量从局部坐标空间到世界坐标空间。
TranslateMoves the transform in the direction and distance of translation.
移动transform在translation的方向和距离。
script/unityengine/classes/transform/transform.txt · 最后更改: 2016/08/02 05:37 (外部编辑)