Transform.TransformPoint 变换位置

原文地址:http://www.ceeger.com/Script/Transform/Transform.TransformPoint.html

function TransformPoint (position : Vector3) : Vector3

Description描述

Transforms position from local space to world space.

变换位置从自身坐标到世界坐标。

Note that the returned position is affected by scale. Use Transform.TransformDirection if you are dealing with directions.

注意,返回位置受缩放影响。如果你是处理方向使用Transform.TransformDirection

// You need to assign an object to this variable in the inspector
//在检视面板你必须指定一个物体到这个变量
var someObject : GameObject;
// Instantiate an object to the right of the current object
//在当前物体的右边,实例化物体
var thePosition = transform.TransformPoint(Vector3.right * 2);
Instantiate(someObject, thePosition, someObject.transform.rotation);

参考:

http://docs.unity3d.com/ScriptReference/Transform.InverseTransformPoint.html
http://docs.unity3d.com/ScriptReference/Transform.TransformPoint.html

posted on 2016-09-11 14:24  ZhYQ_note  阅读(838)  评论(0)    收藏  举报

导航