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