Unity检测一个点是否在物体边缘包围框内
2019-07-29 本文已影响0人
沉麟
public GameObject target = null;
void Update () {
Vector3 pos = GetComponent<Collider>().ClosestPoint(target.transform.position);
if (Vector3.Distance(pos, target.transform.position) <= 0.01) {
Debug.Log("Contains");
}
}