Esempio n. 1
0
    void Start()
    {
        Instantiate(arrow, Vector3.zero, Quaternion.Euler(new Vector3(0, 0, longitudeOfTheAscendingNode)));
        Instantiate(arrow, Vector3.zero, Quaternion.Euler(new Vector3(0, 0, longitudeOfTheAscendingNode + argumentOfPeriapsis)));

        semiminorAxis = semimajorAxis * Mathf.Sqrt(1 - Mathf.Pow(eccentricity, 2));
        focalParam    = Mathf.Pow(semiminorAxis, 2) / semimajorAxis;

        //positions with angle 0
        float      xPosition         = -(semimajorAxis * eccentricity);
        float      yPosition         = 0;
        float      rotation          = longitudeOfTheAscendingNode + argumentOfPeriapsis;
        GameObject orbitLineInstance = Instantiate(orbitLine,
                                                   new Vector3(xPosition * Mathf.Cos(rotation * Mathf.Deg2Rad) - yPosition * Mathf.Sin(rotation * Mathf.Deg2Rad),
                                                               yPosition * Mathf.Cos(rotation * Mathf.Deg2Rad) + xPosition * Mathf.Sin(rotation * Mathf.Deg2Rad),
                                                               0),
                                                   Quaternion.identity);

        DrawEllipse drawEllipse = orbitLineInstance.GetComponent <DrawEllipse>();

        drawEllipse.xradius = semimajorAxis;
        drawEllipse.yradius = semiminorAxis;
        orbitLineInstance.transform.rotation = Quaternion.Euler(new Vector3(0, 0, longitudeOfTheAscendingNode + argumentOfPeriapsis));
        drawEllipse.Draw();
        linearSpeed = Mathf.PI * semimajorAxis * semiminorAxis / 1000;
        angle       = 0;
    }
Esempio n. 2
0
    void Start()
    {
        semiMinorAxis = semiMayorAxis * Mathf.Sqrt(1 - Mathf.Pow(excentricity, 2));
        focalParam    = Mathf.Pow(semiMinorAxis, 2) / semiMayorAxis;

        GameObject  orbitLineInstance = Instantiate(orbitLine, Vector3.zero, Quaternion.identity);
        DrawEllipse drawEllipse       = orbitLineInstance.GetComponent <DrawEllipse>();

        drawEllipse.xradius = semiMayorAxis;
        drawEllipse.yradius = semiMinorAxis;
        orbitLineInstance.transform.rotation = Quaternion.Euler(new Vector3(0, 0, newAngle));
        drawEllipse.Draw();
        angle = 0;
    }