Transform.TransformDirection

来源:互联网 发布:小猪网络 编辑:程序博客网 时间:2024/05/16 00:40


Transform.TransformDirection 变换方向

function TransformDirection (direction : Vector3) : Vector3

Description描述

Transforms direction from local space to world space.

从自身坐标到世界坐标变换方向。

This operation is not affected by scale or position of the transform. The returned vector has the same length as direction.

这个操作不会受到变换的缩放和位置的影响。返回的向量与direction有同样的长度。


实例说明:


m_cube是一个沿着X轴旋转了90度的方块。


方块沿着自身的z轴移动

m_cube.transform.Translate(Vector3.forward)



方块沿着世界的z轴移动

m_cube.transform.Translate(m_cube.transform.TransformDirection(Vector3.forward) );




2 0