Transform.TransformDirection 变换方向


官方描述:

JavaScript ⇒ TransformDirection(direction: Vector3): Vector3; 
C# ⇒ Vector3 TransformDirection(Vector3 direction);

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有同样的长度。

 

个人理解:
如自身Z轴方向跟世界Z轴方向一致,目前我的位置是(0,0,0),我向前(相对自身)移动一个单位,我的位置变成(0,0,1),
即为:transform.postion += vector3(0,0,1);
当自身Z轴方向跟世界X轴方向一致时,我的位置还是(0,0,0),我向前(相对自身)移动一个单位,我的位置变成(1,0,0),
即为:transform.postion += transform.TransformDirection(vector3(0,0,1))的结果。
    
 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM