Exemple #1
0
    private void OnDrawGizmosSelected()
    {
        if (orbiter == null)
        {
            orbiter = GetComponent <Orbiter>();
        }

        // Bail out if there is no object to orbit around
        if (!orbiter.orbitAround)
        {
            return;
        }

        // Recalculate the ellipse only when in the editor
        if (!Application.isPlaying)
        {
            if (orbiter.Ellipse() == null)
            {
                return;
            }
            orbiter.Ellipse().Update(orbiter.orbitAround.position, transform.position, orbiter.apsisDistance, orbiter.circularOrbit);
        }

        DrawEllipse();
        DrawStartingPosition();
    }