// Update is called once per frame
    void Update()
    {
        float distance;
        float min_distance = CalcDistance(transform.gameObject, ar_camera);

        foreach (GameObject part in robot_parts)
        {
            distance = CalcDistance(part, ar_camera);
            //Debug.Log("Name: " + part.name + ", distance: " + distance + ", min: " + min_distance);
            if (distance < min_distance)
            {
                min_distance = distance;
            }
        }

        debug.ClearDebug();
        debug.Debug("Distance: " + min_distance.ToString("f2"));

        if (min_distance < safety_distance)
        {
            if (robot_state != ROBOT_STATE_DANGER)
            {
                ChangeRobotColors(danger_color, ROBOT_STATE_DANGER);
            }
        }
        else if (min_distance > more_safety_distance)
        {
            if (robot_state != ROBOT_STATE_MORE_SAFETY)
            {
                ChangeRobotColors(origin_colors, ROBOT_STATE_MORE_SAFETY);
            }
        }
        else
        {
            if (robot_state != ROBOT_STATE_SAFETY)
            {
                ChangeRobotColors(safety_color, ROBOT_STATE_SAFETY);
            }
        }
    }