CarControl.GoToWayPoint C# (CSharp) Method

GoToWayPoint() private method

private GoToWayPoint ( ) : void
return void
    private void GoToWayPoint()
    {
        float steer = 0;
        if (leftObj && !rightObj)
            steer = Mathf.Max (1.2f/LeftDis, 0.35f);
        if (rightObj && !leftObj)
            steer = -1 * Mathf.Max (1.2f/RightDis, 0.35f);
        if (centerObj && !rightObj && !leftObj) {
            steer = Mathf.Max (1.2f/CenterDis, 0.35f);
        }
        if (centerObj && (leftObj || rightObj)) {
            steer = steer * 1.42f;
        }

        Vector3 travelDirection = transform.InverseTransformPoint(new Vector3 (currentWayPoints[current_point].x, transform.position.y, currentWayPoints[current_point].z));

        // For skipping if waypoint behind me
        Vector3 relPosition = transform.InverseTransformPoint (currentWayPoints [current_point]);
        if (relPosition.z <= 0) {
            int see_ahead = current_point + 1;
            //move to the next path segment
            if (see_ahead >= currentWayPoints.Count) {
                currentWayPoints = nextWayPoints;
                pathCalculated = false;
                see_ahead = 0;
            }
            Vector3 seeDirection = transform.InverseTransformPoint (new Vector3 (currentWayPoints[see_ahead].x, transform.position.y, currentWayPoints[see_ahead].z));
            if (seeDirection.z > 0) {
                print ("Skipping waypoint");
                current_point = see_ahead;
                return;
            }
        }
        input_steer = travelDirection.x / travelDirection.magnitude + steer;
        if (input_steer > 1) {
            //input_steer = 1;
            input_steer = Mathf.Min (input_steer, 1.25f);
        }
        if (input_steer < -1) {
            //input_steer = -1;
            input_steer = Mathf.Max (input_steer, -1.25f);
        }

        if ((input_steer > 0.35f || input_steer < -0.35f) && rb.velocity.magnitude > 7) {
            input_torque = travelDirection.z / travelDirection.magnitude - Mathf.Abs (input_steer);
        } else {
            input_torque = travelDirection.z / travelDirection.magnitude;
        }

        if (travelDirection.magnitude < 12) {
            current_point ++;

            if (current_point >= currentWayPoints.Count) {
                currentWayPoints = nextWayPoints;
                pathCalculated = false;
                current_point = 0;
            }
        }

        //Debug.Log ("Current Way Point: " + current_point);
        int next_point = current_point + 1;
        if (next_point >= currentWayPoints.Count) {
            currentWayPoints = nextWayPoints;
            pathCalculated = false;
            current_point = 0;
        }
        Vector3 nextDirection = transform.InverseTransformPoint (new Vector3 (currentWayPoints[current_point].x, transform.position.y, currentWayPoints[current_point].z));
        float angle = Vector3.Angle (travelDirection, nextDirection);

        if ((leftObj || rightObj || centerObj) && (input_torque > 0) && (rb.velocity.magnitude > 1)) {
            brake_power = brakeTorque * input_torque;
        } else {
            brake_power = 0.0f;
        }
        //print (rb.velocity.sqrMagnitude);
    }