// Update is called once per frame
 void FixedUpdate()
 {
     gaugeFill.rectTransform.sizeDelta    = new Vector2(250 * PilloController.GetSensor((PilloID)m_pilloIndex, true), 24);        //use the calibrated value to scale to green bar
     gaugeFillRaw.rectTransform.sizeDelta = new Vector2(250 * PilloController.GetSensor((PilloID)m_pilloIndex, false), 10);       // use the raw value to scale the blue bar
     if (PilloController.IsPilloCalibrated((PilloID)m_pilloIndex))
     {
         calibratedText.text  = "IS CALIBRATED";
         calibratedText.color = Color.green;
     }
     else
     {
         calibratedText.text  = "IS NOT CALIBRATED";
         calibratedText.color = Color.red;
     }
 }
Exemple #2
0
    void _update(Pillo.PilloID pillo)
    {
        // set height based on Pillo sensor, and use calibrated values if available
        Vector3 tmp = m_slider[(int)pillo].transform.position;

        tmp.y = 10 * PilloController.GetSensor(pillo, PilloController.IsPilloCalibrated(pillo));
        m_slider[(int)pillo].transform.position = tmp;
        // show Pillo orientation based on accelerometer
        Vector3 acceleration = PilloController.GetAccelero(pillo);
        float   angleX       = Vector3.Angle(Vector3.right, acceleration) - 90;
        float   angleZ       = Vector3.Angle(Vector3.up, acceleration) - 90;

        m_slider [(int)pillo].transform.rotation = Quaternion.Euler(angleX, 0, angleZ);
        Quaternion accelQ = Quaternion.Euler(angleX, 0, angleZ);
        float      accelZ = accelQ.eulerAngles.z;

        Debug.Log(accelZ);
        //Debug.Log ("y" + (Vector3.Angle (Vector3.forward, acceleration) - 90));
    }