private float calcAngle(int index, Attractor orbitingBody)
    {
        if (att.prediction.Count == 0)
        {
            return(0);
        }

        int steps = Attracted.getFutureStepsFromPredictionIndex(index);

        Vector2 vec = orbitingBody.getPosInPhysicsSteps(steps) - att.prediction[index];

        return(Mathf.Atan2(vec.y, vec.x));
    }
    void Update()
    {
        //make sure the prediction is up to date
        att.CalculatePrediction();

        //make sure we have the correct number of lines
        //set the lines verticies
        List <Vector3> positions = new List <Vector3>();

        Attractor currentSOI = null;
        int       lineIndex  = -1;

        //TODO: count rotation around each body and stop drawing the line if it passes a set threshold

        float lastAngle  = calcAngle(0, att.getOrbitingBody());
        float totalAngle = 0;
        bool  stop       = false;

        for (int i = 0; i < att.prediction.Count; i += linePointInc)
        {
            if (currentSOI != att.prediction[i].strongestAttractor || i == att.prediction.Count - 1 || stop)
            {
                setLineVerts(lineIndex, positions);
                ++lineIndex;
                validateLineIndex(lineIndex);

                if (positions.Count != 0)
                {
                    if (currentSOI != att.prediction[i].strongestAttractor)
                    {
                        WidgetDisplay.getWidgetDisplay().DisplayWidget(TransferNodeWidget, positions[positions.Count - 1], new Vector2(widgetSize, widgetSize), lineColors[lineIndex % lineColors.Length].startColor);
                    }

                    //draw apoapsis and periapsis
                    OrbitProperties properties = att.getOrbitProperties(currentSOI, i - positions.Count);
                    if (properties != null)
                    {
                        Vector2 apoapsisPos  = att.prediction[Attracted.getPredictionIndexFromFutureSteps(properties.stepsToApoapsis)];
                        Vector2 periapsisPos = att.prediction[Attracted.getPredictionIndexFromFutureSteps(properties.stepsToPeriapsis)];

                        apoapsisPos  = currentSOI.transformPositionReletiveSteps(apoapsisPos, Attracted.getFutureStepsFromPredictionIndex(properties.stepsToApoapsis));
                        periapsisPos = currentSOI.transformPositionReletiveSteps(periapsisPos, Attracted.getFutureStepsFromPredictionIndex(properties.stepsToPeriapsis));

                        if (properties.stepsToApoapsis != 0)
                        {
                            WidgetDisplay.getWidgetDisplay().DisplayWidget(ApoapsisWidget, apoapsisPos,
                                                                           new Vector2(widgetSize, widgetSize), lineColors[(lineIndex - 1) % lineColors.Length].startColor);
                        }

                        if (properties.stepsToPeriapsis != 0)
                        {
                            WidgetDisplay.getWidgetDisplay().DisplayWidget(PeriapsisWidget, periapsisPos,
                                                                           new Vector2(widgetSize, widgetSize), lineColors[(lineIndex - 1) % lineColors.Length].startColor);
                        }
                    }
                }

                currentSOI = att.prediction[i].strongestAttractor;
                positions.Clear();

                lastAngle  = calcAngle(i, currentSOI);
                totalAngle = 0;

                if (stop)
                {
                    break;
                }
            }

            Vector2 pos = currentSOI.transformPositionReletiveSteps(att.prediction[i], Attracted.getFutureStepsFromPredictionIndex(i));

            if (i == att.prediction.Count - 1 && att.IntersectionDetected)
            {
                WidgetDisplay.getWidgetDisplay().DisplayWidget(CollisionWidget, pos, new Vector2(widgetSize, widgetSize), Color.red);
            }

            float angle = calcAngle(i, currentSOI);

            if (Mathf.Abs(angle - lastAngle) < Mathf.PI)
            {
                totalAngle += Mathf.Abs(angle - lastAngle);
            }


            lastAngle = angle;

            if (totalAngle >= (Mathf.PI * 2) * (maxRotationsPerPlanet))
            {
                stop = true;
            }

            positions.Add(pos);
        }

        //setLineVerts(lineIndex, positions);

        clearAllLinesAfterIndex(lineIndex - 1);
    }