unity:坐标变换 - 两个函数
在cocos中,我们知道有如下的坐标变换函数:
CCPoint convertToNodeSpace(const CCPoint& worldPoint);
CCPoint convertToWorldSpace(const CCPoint& nodePoint);
CCPoint convertToNodeSpaceAR(const CCPoint& worldPoint);
CCPoint convertToWorldSpaceAR(const CCPoint& nodePoint);
同样在untiy中也有类似的坐标变换函数:
Transform.TransformPoint
Transforms position
from local space to world space.
本地坐标转换到世界坐标
Transform.InverseTransformPoint
Transforms position
from world space to local space.
世界坐标转换到本地坐标
参考:
http://docs.unity3d.com/ScriptReference/Transform.InverseTransformPoint.html
http://www.ceeger.com/Script/Transform/Transform.TransformPoint.html