Unity 相机朝向与目标之间的夹角

using UnityEngine;

public class MyTest : MonoBehaviour
{
    
    
    public Transform cameraTransform;
    public Transform target;

    void Update()
    {
    
    
        float angle = Vector3.Angle(cameraTransform.forward, target.position - cameraTransform.position);
        Debug.LogError("夹角:" + angle);
    }
}

猜你喜欢

转载自blog.csdn.net/a0_67/article/details/131601146
今日推荐