当前位置:网站首页>About transform InverseTransformPoint, transform. InverseTransofrmDirection

About transform InverseTransformPoint, transform. InverseTransofrmDirection

2022-06-24 21:34:00 charlsdm

The following is an introduction transform.InverseTransformPoint,
transform.InverseTransformDirection and transform.InverseTransformVector
The code is attached below

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class InversePoint : MonoBehaviour
{
    
    // Start is called before the first frame update
    void Start()
    {
    
        Debug.Log(Vector3.forward);

        Debug.Log(" The converted point " + this.transform.InverseTransformPoint(Vector3.forward));

        Debug.Log(" After the change of direction ( Not affected by scaling )" + this.transform.InverseTransformDirection(Vector3.forward));

        Debug.Log(" After the change of direction ( Affected by scaling )" + this.transform.InverseTransformVector(Vector3.forward));
    }

    // Update is called once per frame
    void Update()
    {
    
        
    }
}

It is the point that converts the world coordinates into the relative local coordinate system
 Insert picture description here
Local to world coordinate system , Affected by scaling


        Debug.Log(" Local to world point " + this.transform.TransformPoint(Vector3.forward));

        Debug.Log(" Local to global ( Not affected by scaling )" + this.transform.TransformDirection(Vector3.forward));

        Debug.Log(" Local   turn   World direction " + this.transform.TransformVector(Vector3.forward));
原网站

版权声明
本文为[charlsdm]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/175/202206241442016982.html