#pragma strict function Start () { } function Update () { var hit:RaycastHit; if(Physics.Raycast(transform.position,transform.forward,hit,8)) { print("射线触碰了"+hit.collider.gameObject+"物体"); } }
时间: 2024-11-08 10:15:00
#pragma strict function Start () { } function Update () { var hit:RaycastHit; if(Physics.Raycast(transform.position,transform.forward,hit,8)) { print("射线触碰了"+hit.collider.gameObject+"物体"); } }