Exemple #1
0
    // Update is called once per frame
    void FixedUpdate()
    {
        if (planeScript.CheckAcceleration())
        {
            planeScript.MovePlane("thrust");
        }
        float distance = Vector3.Distance(this.transform.position, followPoint.position);

        if (distance > 15f && !isAvoiding)
        {
            MoveToFollow();
        }
        if (isChecking)
        {
            // Check if we're running into collider

            RaycastHit hit;
            foreach (GameObject point in rayArr)
            {
                if (Physics.Raycast(point.transform.position, point.transform.forward, out hit, 8f, mask))
                {
                    isAvoiding = true;
                    MoveToAvoid();
                }
            }
        }
    }