示例#1
0
    // Update is called once per frame
    void Update()
    {
        Ray Ray = new Ray(transform.position, transform.right);

        RaycastHit HitObjRight;
        RaycastHit HitObjLeft;

        Vector3 forward = transform.TransformDirection(transform.right) * 10;

        Debug.DrawRay(transform.position, forward, Color.green);
        if (Physics.Raycast(Ray, out HitObjLeft, 100))
        {
            //				line.SetPosition (1, hit.point);
            if (HitObjLeft.transform.CompareTag("Car"))
            {
                gameStaticData.CheckPosD();
//				print ("@@@@@@@@@@@@@@@@@@@");
            }
        }
                #if UNITY_EDITOR
        //line.SetPosition (0, this.transform.position);
        //line.SetPosition (1, Ray.GetPoint (100));
                #endif
    }