void Update()
    {
        accumulatedDeltaTime += Time.deltaTime * simulationSpeedFactor;
        if (accumulatedDeltaTime >= vehicleDt)
        {
            accumulatedDeltaTime = 0.0f;
            // Get positions of virtual structure edges
            PointInfo[] edges = formationRectangle.getEdges();

            Vector3    targetPosition = agents [0].transform.position;
            List <int> failedAgents   = new List <int> ();
            if (winnerIdx == agents.Length - 1 || !moveNearestAgent(targetPosition, winnerIdx))
            {
                failedAgents.Add(winnerIdx);
                for (int t = 1; t < agents.Length - 1; t++)
                {
                    // Get closest player to opponent
                    float minDistance = float.MaxValue;

                    for (int i = 1; i < agents.Length - 1; i++)
                    {
                        // If this agent has failed moving before, due to moving the formation out of the polygon
                        if (failedAgents.Contains(i))
                        {
                            continue;
                        }
                        float distance = Vector2.Distance(new Vector2(targetPosition.x, targetPosition.z), getDesiredPosition(i - 1));
                        if (distance < minDistance)
                        {
                            minDistance = distance;
                            winnerIdx   = i;
                        }
                    }

                    // If movement of agent succeeds without collision of the formation with the boundary polygon
                    if (moveNearestAgent(targetPosition, winnerIdx))
                    {
                        break;
                    }
                    failedAgents.Add(winnerIdx);
                    winnerIdx = agents.Length - 1;
                }
            }
            //If noone can move
            if (winnerIdx == agents.Length - 1)
            {
                setRelativeFormationPositions(this.relativeFormationPositions, winnerIdx - 1);
                this.desiredRelativePositions = getDesiredPositions(winnerIdx, false, false);
                this.desiredAbsolutePositions = getDesiredPositions(winnerIdx, false, true);
                FootballPlayerController virtualCenterController = agents[agents.Length - 1].GetComponent <FootballPlayerController>();
                virtualCenterController.setPlay(false);
            }
        }
    }