#pragma strict function Start () { } function Update () { var hit:RaycastHit; if(Physics.Raycast(transform.position,transform.forward,hit,8)) { print("射线触碰了"+hit.collider.gameObject+"物体"); } }
时间: 2025-01-13 09:52:32
#pragma strict function Start () { } function Update () { var hit:RaycastHit; if(Physics.Raycast(transform.position,transform.forward,hit,8)) { print("射线触碰了"+hit.collider.gameObject+"物体"); } }