Ejemplo n.º 1
0
    void Update()
    {
        //the 41 and 4 is based on how many pixels to the edge of the groove

        GameObject      g        = GameObject.FindGameObjectWithTag("airplane");
        aircraft_script aircraft = g.GetComponent <aircraft_script> ();

        deg = aircraft.angleYaw;

        xFactor = origin.x + (deg * 0.02f / 90);
        if (deg >= 0)
        {
            yFactor = origin.y + (deg * 0.00227f / 90);
        }
        else
        {
            yFactor = origin.y + (-deg * 0.00227f / 90);
        }

        Vector3 temp = transform.localPosition;

        temp.x = xFactor;
        temp.y = yFactor;

        transform.localPosition = temp;
    }
Ejemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        //apply the aircraft script to the plane object and reference it with the tag
        //right now its pointed at the asi needle image
        GameObject      g        = GameObject.FindGameObjectWithTag("airplane");
        aircraft_script aircraft = g.GetComponent <aircraft_script> ();

        speed = aircraft.velocity;

        //speed += Time.deltaTime;

        speedFactor = speed * (101.5f / 80);
//		if (speed <= 130) {
//			speedFactor = speed * (210.226f / 130);
//		} else if (speed <= 160) {
//			speedFactor = 130f * (210.226f / 130) + speed * (264.139f / 160);
//		} else {
//			speedFactor = 130f * (210.226f / 130) + 160f * (264.139f / 160) + speed * (312.442f / 200);
//		}

        Vector3 temp = transform.rotation.eulerAngles;

        temp.z             = -speedFactor;
        transform.rotation = Quaternion.Euler(temp);
    }
Ejemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        if (instance != null)
        {
            Debug.LogError("There should only be one instance of plane script!");
            Destroy(gameObject);
        }

        instance = this;
    }
Ejemplo n.º 4
0
    // Update is called once per frame
    void Update()
    {
        GameObject      g        = GameObject.FindGameObjectWithTag("airplane");
        aircraft_script aircraft = g.GetComponent <aircraft_script> ();

        alt = (aircraft.altitude - Mathf.Floor(aircraft.altitude / 1000f)) / 100;

        altFactor = alt * (360 / maxAlt);
        Vector3 temp = transform.rotation.eulerAngles;

        temp.z             = -altFactor;
        transform.rotation = Quaternion.Euler(temp);
    }
Ejemplo n.º 5
0
    // Update is called once per frame
    void Update()
    {
        GameObject      g        = GameObject.FindGameObjectWithTag("airplane");
        aircraft_script aircraft = g.GetComponent <aircraft_script> ();

        hSit = aircraft.gyro / 10;

        hSFactor = hSit * (360 / maxH) + aircraft.angleRoll;
        Vector3 temp = transform.rotation.eulerAngles;

        temp.z = hSFactor;

        transform.rotation = Quaternion.Euler(temp);
    }
Ejemplo n.º 6
0
    // Update is called once per frame
    void Update()
    {
        GameObject      g        = GameObject.FindGameObjectWithTag("airplane");
        aircraft_script aircraft = g.GetComponent <aircraft_script> ();

        deg = aircraft.anglePitch;

        pitch = origin.y + (-1f * deg * (0.006795864f / 10));

        Vector3 temp = transform.localPosition;

        temp.y = pitch;

        transform.localPosition = temp;
    }
Ejemplo n.º 7
0
    // Update is called once per frame
    void Update()
    {
        //	x = x + Time.deltaTime;

        GameObject      g        = GameObject.FindGameObjectWithTag("airplane");
        aircraft_script aircraft = g.GetComponent <aircraft_script> ();

        turn = aircraft.angleRoll;

        Vector3 temp = transform.rotation.eulerAngles;

        //temp.z = 2*turn;
        temp.z             = 0;
        transform.rotation = Quaternion.Euler(temp);
    }
Ejemplo n.º 8
0
    // Update is called once per frame
    void Update()
    {
        //speed += Time.deltaTime;

        GameObject      g        = GameObject.FindGameObjectWithTag("airplane");
        aircraft_script aircraft = g.GetComponent <aircraft_script> ();

        vSpeed      = (101.288f * aircraft.velocity * Mathf.Sin(aircraft.anglePitch * (Mathf.PI / 180))) / 100;
        speedFactor = vSpeed * (172f / 20);

        Vector3 temp = transform.rotation.eulerAngles;

        temp.z             = -speedFactor;
        transform.rotation = Quaternion.Euler(temp);
    }
Ejemplo n.º 9
0
    //angleRoll
    // Update is called once per frame
    void Update()
    {
        //speed += Time.deltaTime;
        //if the first mark is not supposed to be 30deg then remove transformation factor
        //as in rotFactor=rot

        GameObject      g        = GameObject.FindGameObjectWithTag("airplane");
        aircraft_script aircraft = g.GetComponent <aircraft_script> ();

        rot = aircraft.angleRoll;

        rotFactor = -rot * (20f / 30) - rot;

        Vector3 temp = transform.rotation.eulerAngles;

        temp.z             = -rotFactor;
        transform.rotation = Quaternion.Euler(temp);
    }