Transform 变换

Inherits from Component,IEnumerable

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),因此你可以使用循环遍历子物体。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
public void Awake() {
foreach (Transform child in transform) {
child.position += Vector3.up * 10.0F;
}
}
}
// Moves all transform children 10 units upwards!
//向上移动所有变换的子物体10个单位
for (var child : Transform in transform) {
	child.position += Vector3.up * 10.0;
}
参见:Physics 类.

Variables变量

Functions函数

Inherited members继承成员

Inherited Variables继承变量

Inherited Functions继承函数

Inherited Class Functions继承类函数

最后修改:2011年5月16日 Monday 21:15

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。