首页 > 代码库 > Unity的射线检测碰撞(JavaScript)

Unity的射线检测碰撞(JavaScript)

#pragma strictfunction Start () {}function Update () {var hit:RaycastHit;    if(Physics.Raycast(transform.position,transform.forward,hit,8))    {        print("射线触碰了"+hit.collider.gameObject+"物体");    }}

 

Unity的射线检测碰撞(JavaScript)