2D
private void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.GetComponent<AttackBox>()) { hitPos = other.bounds.ClosestPoint(transform.position); print("碰撞点" + hisPos); } }
3D
other.gameObject.GetComponent<Collider>().ClosestPointOnBounds(transform.position);