using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ScanObj : MonoBehaviour
{
public GameObject obj;
Vector3 hitPos;
void Start()
{
}
void Update()
{
print("碰撞点" + gameObject.GetComponent<Collider>().ClosestPoint(gameObject.transform.position));
Debug.DrawLine(obj.GetComponent<Collider>().ClosestPoint(transform.position), transform.position, Color.red);
}
private void OnTriggerStay(Collider other)
{
/*hitPos = other.bounds.ClosestPoint(transform.position);
print("碰撞点" + gameObject.GetComponent<Collider>().ClosestPoint(gameObject.transform.position));
Debug.DrawLine(hitPos, gameObject.GetComponent<Collider>().ClosestPoint(gameObject.transform.position), Color.red);*/
}
}
Unity 模拟扫描物体-获取物体表面上最近的两个点
最新推荐文章于 2024-08-30 06:00:00 发布