Example #1
0
    // Use this for initialization
    void Start()
    {
        GravityEngine ge = GravityEngine.Instance();

        time.text = string.Format(time_format, ge.GetTimeWorldSeconds(), ge.GetTimeZoom());
        Vector3 pos = ship.initialPos;

        position.text = string.Format(pos_format, pos.x, pos.y, pos.z);
        velocity.text = string.Format(vel_format, 0f, 0f, 0f);
        if (rocketEngine == null)
        {
            Debug.LogError("Need a rocket component");
        }
        fuelText.text = string.Format(fuel_format, rocketEngine.GetFuel());
        attitude.text = string.Format(attitude_format, 0f, 0f, 0f);

        // assume earth at (0,0,0)
        initial_altitude = Vector3.Magnitude(ship.transform.position) - (float)atmosphere.heightEarthSurface;
        altitude.text    = string.Format(altitude_format, initial_altitude);

        if (drag != null)
        {
            drag.text = string.Format(drag_format, atmosphere.GetAccelSI());
        }

        if (accel != null)
        {
            accel.text = string.Format(accel_format, earthRocket.GetAccel());
        }

        if (thrust != null)
        {
            thrust.text = string.Format(thrust_format, 100f);
        }
    }
Example #2
0
    public void SetTextInfo(float fuel, Vector3 angles)
    {
        GravityEngine ge = GravityEngine.Instance();

        time.text = string.Format(time_format, ge.GetTimeWorldSeconds(), ge.GetTimeZoom());
        double[] r = new double[3];
        double[] v = new double[3];
        GravityEngine.Instance().GetPositionVelocityScaled(ship, ref r, ref v);

        position.text = string.Format(pos_format, r[0], r[1], r[2]);
        velocity.text = string.Format(vel_format, v[0], v[1], v[2]);
        fuelText.text = string.Format(fuel_format, fuel);
        attitude.text = string.Format(attitude_format, angles.y, angles.x, angles.z);

        altitudeNow   = Vector3.Magnitude(ship.transform.position) - (float)atmosphere.heightEarthSurface;
        altitude.text = string.Format(altitude_format, altitudeNow);

        if (drag != null)
        {
            drag.text = string.Format(drag_format, atmosphere.GetAccelSI());
        }

        if (accel != null)
        {
            accel.text = string.Format(accel_format, earthRocket.GetAccel());
        }
        if (thrust != null)
        {
            thrust.text = string.Format(thrust_format, rocketEngine.GetThrottlePercent());
        }
    }
Example #3
0
    // Use this for initialization
    void Start()
    {
        GravityEngine ge = GravityEngine.Instance();

        time.text = string.Format(time_format, ge.GetPhysicalTime(), ge.GetTimeZoom());
        Vector3 pos = ship.initialPos;

        position.text = string.Format(pos_format, pos.x, pos.y, pos.z);
        velocity.text = string.Format(vel_format, 0f, 0f, 0f);
        RocketEngine rocketEngine = ship.GetComponent <RocketEngine>();

        if (rocketEngine == null)
        {
            Debug.LogError("Need a rocket component");
        }
        fuelText.text = string.Format(fuel_format, rocketEngine.GetFuel(ge.GetPhysicalTime()));
        attitude.text = string.Format(attitude_format, 0f, 0f, 0f);

        // assume earth at (0,0,0)
        initial_altitude = Vector3.Magnitude(ship.transform.position);
        altitude.text    = string.Format(altitude_format, 0f);
    }