devNotes 6-16-16 pipeline back to vr, movement, sphere cursor

http://argos.vu/ArgosVu_VR_AudioSensors.apk

gsfgngfnd

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using Vectrosity;
using System.Collections.Generic;
using Vuforia;

public class GF_Manager : MonoBehaviour
{
    public GameObject[] GO_panels;
    public int PStart_Focus_Idx;
    public Text Dubug_Txt;
    private Transform camTrans;
    private Vector2 v2ForwdPrj_Curr;
    private Vector2 v2ForwdPrj_Prev;

    private int maxEntries = 100000;
    private List<InputData>[] IDT;//IDT Input Data Table - Lists of all Sensor Data
    private float fElapsedTime;
    private float fRendTime;

    public enum FT
    {
        Accel_X,
        Accel_Y,
        Accel_Z,

        Gyro_Att_qX,
        Gyro_Att_qY,
        Gyro_Att_qZ,
        Gyro_Att_qW,

        Gyro_Att_euX,
        Gyro_Att_euY,
        Gyro_Att_euZ,

        Gyro_Grav_X,
        Gyro_Grav_Y,
        Gyro_Grav_Z,

        Gyro_Rota_Rate_X, //*
        Gyro_Rota_Rate_Y,
        Gyro_Rota_Rate_Z,

        Gyro_Rota_Rate_UB_X,
        Gyro_Rota_Rate_UB_Y,
        Gyro_Rota_Rate_UB_Z,

        Gyro_Accel_X,
        Gyro_Accel_Y,
        Gyro_Accel_Z,

        Mag_Heading_Accuracy,//degrees

        Mag_Heading, //degrees

        Mag_Raw_Vec_X,//*
        Mag_Raw_Vec_Y,
        Mag_Raw_Vec_Z,

        Mag_True_Heading,

        NUM_FT,
    };

    public enum Panel_State
    {
        OFF,
        LOW,
        MID,
        FOCUS,
        XXX,
    };

    //RENDERING SEQUENCE 0 Low 1 Mid 2 Focus 3 Mid 4 Low
    //
    // 1 3 0  1 3 4  1 3 0  1 3 4  1 3 0  1 3 4  

    private GraphFloat[] gfRender_Group;
    private int[] rSequence;
    private int rSeq_Curr_Idx;

    private float degrees_prev;

    void Start ()
    {
        Input.gyro.enabled = true;
        Input.compass.enabled = true;

        //camTrans = Camera.main.transform;
        //v2ForwdPrj_Curr = new Vector2();
        //v2ForwdPrj_Prev = new Vector2();

        //v2ForwdPrj_Prev.x = camTrans.forward.x;
        //v2ForwdPrj_Prev.y = camTrans.forward.y;
        //v2ForwdPrj_Prev.Normalize();

        degrees_prev = Mathf.Atan2(v2ForwdPrj_Prev.x, v2ForwdPrj_Prev.y) * 360.0f / (2.0f * Mathf.PI);

        gfRender_Group = new GraphFloat[5];            
        //Set_Panel_States(PStart_Focus_Idx);
        rSequence = new int[] { 1, 3, 0, 1, 3, 4 };
        rSeq_Curr_Idx = 0;
        fRendTime = 0.0f;
        fElapsedTime = 0.0f;

        //Set GF_Ids
        for (int i = 0; i< GO_panels.Length;i++)
        {
            GO_panels[i].GetComponentInChildren<GraphFloat>().Gf_Id = i; 
        }

        //INPUT DATA TABLE Init
        IDT = new List<InputData>[(int)FT.NUM_FT];

        for (int i = 0; i< (int)FT.NUM_FT;  i++)
        {
            IDT[i] = new List<InputData>();
        }
	}

    public List<InputData> Get_List(int ListNo)
    {
        return IDT[ListNo];
    }

    private void Set_Panel_States(int focus_panel)
    {
        int numPanels = GO_panels.Length;

        GraphFloat gf = new GraphFloat();

        Panel_State[] p_stamp = new Panel_State[5];

        p_stamp[0] = Panel_State.LOW;
        p_stamp[1] = Panel_State.MID;
        p_stamp[2] = Panel_State.FOCUS;
        p_stamp[3] = Panel_State.MID;
        p_stamp[4] = Panel_State.LOW;

        for(int i = 0; i<numPanels; i++)
        {
            gf = GO_panels[i].GetComponentInChildren<GraphFloat>();
            gf.Panel_State = Panel_State.OFF;
        }

        int pNO = focus_panel - 2;

        if (pNO < 0) pNO = numPanels + pNO;

        for (int i = 0; i < 5; i++)
        {
            gfRender_Group[i] = GO_panels[pNO].GetComponentInChildren<GraphFloat>();
            gfRender_Group[i].Panel_State = p_stamp[i];
            pNO++;
            if (pNO > (numPanels - 1)) pNO = 0;
        }
    }

    Vector3 testAccel;
    private void Set_InputData()
    {
        fElapsedTime += Time.deltaTime;
        Vector3 iAccel = new Vector3();

        Vector3 iMagRawVec = new Vector3();
        Quaternion iqGyroAtt = new Quaternion();
        Vector3 iGyroGravity = new Vector3();
        Vector3 iGyroRotaRate = new Vector3();
        Vector3 iGyroRotaRate_UB = new Vector3();
        Vector3 iGyroAccel = new Vector3();
        float iMagHeadingAccuracy;
        float iMagHeading;
        float iTrueHeading;
        InputData[] id = new InputData[(int)FT.NUM_FT];

        int i;
        for (i = 0; i< (int)FT.NUM_FT; i++)
        {
            id[i] = new InputData();
        }

        //testAccel.x = Mathf.Sin(2f * Mathf.PI * fElapsedTime);
        //testAccel.y = Mathf.Cos(2f * Mathf.PI * fElapsedTime);
        //testAccel.z = 0.707f;


        iAccel = Input.acceleration;//testAccel;//
        iGyroRotaRate = Input.gyro.rotationRate;
        iqGyroAtt = Input.gyro.attitude;
        iGyroGravity = Input.gyro.gravity;
        iGyroRotaRate_UB = Input.gyro.rotationRateUnbiased;
        iGyroAccel = Input.gyro.userAcceleration;
        iMagHeadingAccuracy = Input.compass.headingAccuracy;
        iMagHeading = Input.compass.magneticHeading;
        iMagRawVec = Input.compass.rawVector;
        iTrueHeading = Input.compass.trueHeading;

        i = 0;
        
        //Accelerometer

        id[i].fTime = fElapsedTime;
        id[i].fVal = iAccel.x;
        IDT[(int)FT.Accel_X].Add(id[i]);
        i++;

        id[i].fTime = fElapsedTime;
        id[i].fVal = iAccel.y;
        IDT[(int)FT.Accel_Y].Add(id[i]);
        i++;

        id[i].fTime = fElapsedTime;
        id[i].fVal = iAccel.z;
        IDT[(int)FT.Accel_Z].Add(id[i]);
        i++;

        //Gyro
        //Gyro Attitude Quat
        id[i].fTime = fElapsedTime;
        id[i].fVal = iqGyroAtt.x;
        IDT[(int)FT.Gyro_Att_qX].Add(id[i]);
        i++;

        id[i].fTime = fElapsedTime;
        id[i].fVal = iqGyroAtt.y;
        IDT[(int)FT.Gyro_Att_qY].Add(id[i]);
        i++;

        id[i].fTime = fElapsedTime;
        id[i].fVal = iqGyroAtt.z;
        IDT[(int)FT.Gyro_Att_qZ].Add(id[i]);
        i++;

        id[i].fTime = fElapsedTime;
        id[i].fVal = iqGyroAtt.w;
        IDT[(int)FT.Gyro_Att_qW].Add(id[i]);
        i++;

        //Gyro Attitude Quat Euler Angles
        id[i].fTime = fElapsedTime;
        id[i].fVal = iqGyroAtt.eulerAngles.x;
        IDT[(int)FT.Gyro_Att_euX].Add(id[i]);
        i++;

        id[i].fTime = fElapsedTime;
        id[i].fVal = iqGyroAtt.eulerAngles.y;
        IDT[(int)FT.Gyro_Att_euY].Add(id[i]);
        i++;

        id[i].fTime = fElapsedTime;
        id[i].fVal = iqGyroAtt.eulerAngles.z;
        IDT[(int)FT.Gyro_Att_euZ].Add(id[i]);
        i++;

        //Gyro Gravity
        id[i].fTime = fElapsedTime;
        id[i].fVal = iGyroGravity.x;
        IDT[(int)FT.Gyro_Grav_X].Add(id[i]);
        i++;

        id[i].fTime = fElapsedTime;
        id[i].fVal = iGyroGravity.y;
        IDT[(int)FT.Gyro_Grav_Y].Add(id[i]);
        i++;

        id[i].fTime = fElapsedTime;
        id[i].fVal = iGyroGravity.z;
        IDT[(int)FT.Gyro_Grav_Z].Add(id[i]);
        i++;

        //Gyroscope Rota Rate
        id[i].fTime = fElapsedTime;
        id[i].fVal = iGyroRotaRate.x;
        IDT[(int)FT.Gyro_Rota_Rate_X].Add(id[i]);
        i++;

        id[i].fTime = fElapsedTime;
        id[i].fVal = iGyroRotaRate.y;
        IDT[(int)FT.Gyro_Rota_Rate_Y].Add(id[i]);
        i++;

        id[i].fTime = fElapsedTime;
        id[i].fVal = iGyroRotaRate.z;
        IDT[(int)FT.Gyro_Rota_Rate_Z].Add(id[i]);
        i++;

        //Gyro_Rota_Rate_UnBiased
        id[i].fTime = fElapsedTime;
        id[i].fVal = iGyroRotaRate_UB.x;
        IDT[(int)FT.Gyro_Rota_Rate_UB_X].Add(id[i]);
        i++;

        id[i].fTime = fElapsedTime;
        id[i].fVal = iGyroRotaRate_UB.y;
        IDT[(int)FT.Gyro_Rota_Rate_UB_Y].Add(id[i]);
        i++;

        id[i].fTime = fElapsedTime;
        id[i].fVal = iGyroRotaRate_UB.z;
        IDT[(int)FT.Gyro_Rota_Rate_UB_Z].Add(id[i]);
        i++;

        //Gyro_Accel,
        id[i].fTime = fElapsedTime;
        id[i].fVal = iGyroAccel.x;
        IDT[(int)FT.Gyro_Accel_X].Add(id[i]);
        i++;

        id[i].fTime = fElapsedTime;
        id[i].fVal = iGyroAccel.y;
        IDT[(int)FT.Gyro_Accel_Y].Add(id[i]);
        i++;

        id[i].fTime = fElapsedTime;
        id[i].fVal = iGyroAccel.z;
        IDT[(int)FT.Gyro_Accel_Z].Add(id[i]);
        i++;

        //Mag_Heading_Accuracy
        id[i].fTime = fElapsedTime;
        id[i].fVal = iMagHeadingAccuracy;
        IDT[(int)FT.Mag_Heading_Accuracy].Add(id[i]);
        i++;

        //Mag_Heading
        id[i].fTime = fElapsedTime;
        id[i].fVal = iMagHeading;
        IDT[(int)FT.Mag_Heading].Add(id[i]);
        i++;

        //Raw Magnetic Vector
        id[i].fTime = fElapsedTime;
        id[i].fVal = iMagRawVec.x;
        IDT[(int)FT.Mag_Raw_Vec_X].Add(id[i]);
        i++;

        id[i].fTime = fElapsedTime;
        id[i].fVal = iMagRawVec.y;
        IDT[(int)FT.Mag_Raw_Vec_Y].Add(id[i]);
        i++;

        id[i].fTime = fElapsedTime;
        id[i].fVal = iMagRawVec.z;
        IDT[(int)FT.Mag_Raw_Vec_Z].Add(id[i]);

        //Mag_True_Heading
        id[i].fTime = fElapsedTime;
        id[i].fVal = iTrueHeading;
        IDT[(int)FT.Mag_True_Heading].Add(id[i]);
        i++;

    }

    private void Rotate_Displays()
    {
        v2ForwdPrj_Curr.x = camTrans.forward.x;
        v2ForwdPrj_Curr.y = camTrans.forward.z;

        v2ForwdPrj_Curr.Normalize();

        if (v2ForwdPrj_Curr != v2ForwdPrj_Prev)
        {
            float degrees = Mathf.Atan2(v2ForwdPrj_Curr.x, v2ForwdPrj_Curr.y) * 360.0f / (2.0f * Mathf.PI);

            float thisRota = Mathf.Lerp(degrees_prev, degrees, 0.05f);
            //Dubug_Txt.text = thisRota.ToString();
            degrees_prev = thisRota;
            transform.eulerAngles = new Vector3(0, thisRota, 0);
            v2ForwdPrj_Prev = v2ForwdPrj_Curr;
        }
    }

    // Update is called once per frame
    void Update ()
    {
        fElapsedTime += Time.deltaTime;
        fRendTime += Time.deltaTime;

        if (IDT.Length < maxEntries)
        {
            Set_InputData();
        }
        //Rotate_Displays();

        //Distribute Drawing of Graphs
        if (fRendTime > 0.03f)
        {
            //foreach(GraphFloat gf in gfRender_Group)
            //{
            //    gf.bCan_Render = false;
            //}

            //gfRender_Group[rSequence[rSeq_Curr_Idx]].bCan_Render = true;
            //rSeq_Curr_Idx++;
            //if (rSeq_Curr_Idx > 5) rSeq_Curr_Idx = 0;
            //fRendTime = 0.0f;
        }
    }
}

public class InputData
{
    private float _fVal;
    private float _fTime;

    public float fVal
    {
        set { _fVal = value;}
        get { return _fVal; }
    }
    public float fTime
    {
        set{ _fTime = value;}
        get{return _fTime;}
    }
}
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using Vectrosity;
using System.Collections.Generic;
using Vuforia;

public class GraphFloat : MonoBehaviour
{
    public Camera vectrocity3DCamera;

    [System.Serializable]
    public class Inputs
    {
        public enum Input : byte
        {
            Accel_X,
            Accel_Y,
            Accel_Z,

            Gyro_Att_qX,
            Gyro_Att_qY,
            Gyro_Att_qZ,
            Gyro_Att_qW,

            Gyro_Att_euX,
            Gyro_Att_euY,
            Gyro_Att_euZ,

            Gyro_Grav_X,
            Gyro_Grav_Y,
            Gyro_Grav_Z,

            Gyro_Rota_Rate_X,
            Gyro_Rota_Rate_Y,
            Gyro_Rota_Rate_Z,

            Gyro_Rota_Rate_UB_X,
            Gyro_Rota_Rate_UB_Y,
            Gyro_Rota_Rate_UB_Z,

            Gyro_Accel_X,
            Gyro_Accel_Y,
            Gyro_Accel_Z,

            Mag_Heading_Accuracy,//degrees

            Mag_Heading, //degrees

            Mag_Raw_Vec_X,
            Mag_Raw_Vec_Y,
            Mag_Raw_Vec_Z,

            Mag_True_Heading,
        }
        public Input input;
        public enum ColorGF : byte { Red, Green, Blue, Violet }
        public ColorGF colorGF;
    }

    public Inputs[] SensInput;//Check Max
    private int iSens_Cnt;

    private List<InputData>[] IDLists;

    public  GF_Manager gf_Manager;

    public Text Title;

    public Text prefabText;//time numbers along x axis
    public Text txMax_y;
    public Text txMin_y;

    public Text tx_YPos;

    public Texture tex;

    VectorLine Border_Points;
    //VectorLine //GraphAxis;
    VectorLine TickMarks;

    VectorLine[] GraphTrace;

    //public DefaultTrackableEventHandler AR_Track;
    private bool bTracking = false;
    private Vector3[] vCorners;
    private Vector3[] vBoxOutline;
    private Vector3 vCenter;
    private float Width;
    private float Height;
    private float pWidth; //past width
    private float pHeight;//past height
    private Vector3 vx;
    private Vector3 vy;
    private float fElapsedTime;
    private Text[] OrdNums;

    private float MX_Accum;
    private float MY_Accum;

    private GF_Manager.Panel_State _panel_state;
    private int _gf_id;
    private bool _bcan_render;

    private int curr_display;
    private bool buttonDownPrev = false;

    public int Gf_Id
    {
        set { _gf_id = value;}
        get { return _gf_id; }
    }

    public GF_Manager.Panel_State Panel_State
    {
        set { _panel_state = value; }
        get { return _panel_state;  }
    }

    public bool bCan_Render
    {
        set { _bcan_render = value; }
        get { return _bcan_render; }
    }

    public MenuManager menuManager;

    void Start()
    {
        VectorLine.SetCamera3D(vectrocity3DCamera);

        iSens_Cnt = SensInput.Length;

        IDLists = new List<InputData>[iSens_Cnt];

        curr_display = 0;

        vCorners = new Vector3[4];
        vBoxOutline = new Vector3[4];
        vCenter = new Vector3();
        Vector3 vx = new Vector3();
        Vector3 vy = new Vector3();

        MX_Accum = 0.0f;
        MY_Accum = 0.0f;

        fElapsedTime = 0.0f;

        GetComponent<RectTransform>().GetWorldCorners(vCorners);
        vx = vCorners[3] - vCorners[0];
        vy = vCorners[1] - vCorners[0];
        pWidth = vx.magnitude;
        pHeight = vy.magnitude;

        vx.Normalize();
        vy.Normalize();

        //Panel Border
        //Border_Points = new VectorLine("Border_Points", new List<Vector3>(), tex, 5.0f, LineType.Continuous);
        //Border_Points.points3.Add(vCorners[0]);
        //Border_Points.points3.Add(vCorners[1]);
        //Border_Points.points3.Add(vCorners[2]);
        //Border_Points.points3.Add(vCorners[3]);
        //Border_Points.points3.Add(vCorners[0]);

        vCenter = Vector3.zero;

        for(int i = 0; i<4; i++)
        {
            vCenter += vCorners[i];
        }
        vCenter /= 4.0f;

        //Border_Points.Draw3DAuto();

        //Axis
        //GraphAxis = new VectorLine("Axis", new List<Vector3>(), tex, 3.0f, LineType.Discrete);
        //GraphAxis.points3.Add(vCenter - vx * pWidth/2.0f);
        //GraphAxis.points3.Add(vCenter + vx * pWidth/2.0f);
        //GraphAxis.Draw3DAuto();

        //Tick Marks
        TickMarks = new VectorLine("TickMarks", new List<Vector3>(), 3.0f, LineType.Discrete);
        TickMarks.Draw3DAuto();

        //Graph Input Data List
        GraphTrace = new VectorLine[iSens_Cnt];

        for (int i = 0; i < iSens_Cnt; i++)
        {
            GraphTrace[i] = new VectorLine("GraphTrace_" + i.ToString(), new List<Vector3>(), 3.0f, LineType.Continuous, Joins.Fill);
            GraphTrace[i].Draw3DAuto();

            if (SensInput[i].colorGF == GraphFloat.Inputs.ColorGF.Red)
            {
                GraphTrace[i].color = Color.red;
            }
            else if (SensInput[i].colorGF == GraphFloat.Inputs.ColorGF.Green)
            {
                GraphTrace[i].color = Color.green;
            }
            else if (SensInput[i].colorGF == GraphFloat.Inputs.ColorGF.Blue)
            {
                GraphTrace[i].color = Color.blue;
            }
            else if (SensInput[i].colorGF == GraphFloat.Inputs.ColorGF.Violet)
            {
                GraphTrace[i].color = Color.magenta;
            }
        }

        //OrdNums - Numbers along x axis
        OrdNums = new Text[10];
        for (int i = 0; i<10; i++)
        {
            OrdNums[i] = Instantiate<Text>(prefabText);
            OrdNums[i].gameObject.transform.parent = this.gameObject.transform;
            OrdNums[i].gameObject.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);
        }
    }
	
    private float FindMax()
    {
        float maxVal = 0.0f;

        for (int i = 0; i < iSens_Cnt; i++)
        {
            if (IDLists[i] == null) break;

            int cnt = IDLists[i].Count;
            if (cnt > 2)
            {
                float fBaseTime = IDLists[i][cnt - 1].fTime;
                float delT;
                for (int k = cnt - 1; k > 0; k--)
                {
                    delT = fBaseTime - IDLists[i][k].fTime;
                    float fAbs = Mathf.Abs(IDLists[i][k].fVal);
                    if (delT > 10.0f) break;
                    if (fAbs > maxVal)
                    {
                        maxVal = fAbs;
                    }
                }
            }
        }
        return maxVal;
    }

    void OnEnable()
    {
        StartCoroutine(OnEnableCoroutine());
    }

    IEnumerator OnEnableCoroutine()
    {
        yield return new WaitForSeconds(0.2f);

        curr_display = 0;

        vCorners = new Vector3[4];
        vBoxOutline = new Vector3[4];
        vCenter = new Vector3();
        Vector3 vx = new Vector3();
        Vector3 vy = new Vector3();

        MX_Accum = 0.0f;
        MY_Accum = 0.0f;

        fElapsedTime = 0.0f;

        GetComponent<RectTransform>().GetWorldCorners(vCorners);
        vx = vCorners[3] - vCorners[0];
        vy = vCorners[1] - vCorners[0];
        pWidth = vx.magnitude;
        pHeight = vy.magnitude;

        vx.Normalize();
        vy.Normalize();

        //Panel Border

        //Border_Points.points3.Add(vCorners[0]);
        //Border_Points.points3.Add(vCorners[1]);
        //Border_Points.points3.Add(vCorners[2]);
        //Border_Points.points3.Add(vCorners[3]);
        //Border_Points.points3.Add(vCorners[0]);

        vCenter = Vector3.zero;

        for (int i = 0; i < 4; i++)
        {
            vCenter += vCorners[i];
        }
        vCenter /= 4.0f;

        //Border_Points.Draw3DAuto();

        //Axis

        //GraphAxis.points3.Add(vCenter - vx * pWidth / 2.0f);
        //GraphAxis.points3.Add(vCenter + vx * pWidth / 2.0f);
        //GraphAxis.Draw3DAuto();

        //Tick Marks

        TickMarks.Draw3DAuto();

        //Graph Input Data List


        for (int i = 0; i < iSens_Cnt; i++)
        {

            GraphTrace[i].Draw3DAuto();

            if (SensInput[i].colorGF == GraphFloat.Inputs.ColorGF.Red)
            {
                GraphTrace[i].color = Color.red;
            }
            else if (SensInput[i].colorGF == GraphFloat.Inputs.ColorGF.Green)
            {
                GraphTrace[i].color = Color.green;
            }
            else if (SensInput[i].colorGF == GraphFloat.Inputs.ColorGF.Blue)
            {
                GraphTrace[i].color = Color.blue;
            }
            else if (SensInput[i].colorGF == GraphFloat.Inputs.ColorGF.Violet)
            {
                GraphTrace[i].color = Color.magenta;
            }
        }
    }


    void OnDisable()
    {
        //Border_Points.points3.Clear();
        //GraphAxis.points3.Clear();
        TickMarks.points3.Clear();


        foreach (VectorLine v in GraphTrace)
        {
            v.points3.Clear();
        }
    }


    private void DrawTrace()
    {
        float max = FindMax();

        txMax_y.text = max.ToString("F2");
        txMin_y.text = (-max).ToString("F2");

        int cnt = IDLists[0].Count;

        foreach(VectorLine v in GraphTrace)
        {
            v.points3.Clear();
        }

        TickMarks.points3.Clear();

        Vector3 vOrigin = vCorners[2] - vy * Height / 2.0f;
        Vector3 vTop = vCorners[2];
        Vector3 vBot = vCorners[3];
        float yC = (Height / 2.0f) / max;
        float xC = Width / 10.0f;
        float yCNorm = Height / 2.0f;

        if (cnt > 2)
        {
            Vector3 vtimeX = new Vector3();
            Vector3 vvalY = new Vector3();

            float fBaseTime = IDLists[0][cnt - 1].fTime;

            float rem05 = fBaseTime % 0.5f;
            float rem1 = fBaseTime % 1.0f;

            float big_tic = 0.08f;
            float sml_tic = 0.04f;           
            vtimeX = vx * xC * rem05;

            int fliptic = 0;
            vvalY = vy * yCNorm * sml_tic;
            if (rem1 > rem05)
            {
                fliptic = 1;
                vvalY = vy * yCNorm * big_tic;
            }       
            TickMarks.points3.Add(vOrigin - vtimeX + vvalY);
            TickMarks.points3.Add(vOrigin - vtimeX - vvalY);

            float half_acm = -0.5f;
            int txI = 0;
            int t1;
            for (int i = 0; i<20; i++)
            {
                half_acm += 0.5f;
                vtimeX = vx * xC * (rem05 + half_acm);
                    
                if ((i + fliptic) % 2 == 0)
                {
                    vvalY = vy * yCNorm * sml_tic;
                }
                else
                {
                    vvalY = vy * yCNorm * big_tic;

                    OrdNums[txI].gameObject.transform.position = vBot - vtimeX - vvalY;

                    t1 = (int)(fBaseTime - half_acm);

                    OrdNums[txI].text = ((float)t1).ToString("F1");

                    txI++;
                }
                TickMarks.points3.Add(vOrigin - vtimeX + vvalY);
                TickMarks.points3.Add(vOrigin - vtimeX - vvalY);

                TickMarks.points3.Add(vTop - vtimeX);
                TickMarks.points3.Add(vTop - vtimeX - vvalY);

                TickMarks.points3.Add(vBot - vtimeX);
                TickMarks.points3.Add(vBot - vtimeX + vvalY);
            }

            float fv;
            float delT;
            for (int j = 0; j < iSens_Cnt; j++)
            {
                cnt = IDLists[j].Count;
                if (cnt < 2) break;
                for (int i = cnt - 1; i > 0; i--)
                {
                    fv = IDLists[j][i].fVal;
                    delT = fBaseTime - IDLists[j][i].fTime;

                    if (delT > 10.0f) break;

                    vtimeX = vx * xC * delT;
                    vvalY = vy * yC * fv;

                    GraphTrace[j].points3.Add(vOrigin - vtimeX + vvalY);
                }
            }
        }
    }

    private void Get_Lists()
    {
        int numTraces = SensInput.Length; 

        for(int i = 0; i< numTraces; i++)
        {
            IDLists[i] = gf_Manager.Get_List((int)SensInput[i].input);
        }
    }

    float accumTime = 0;
    private void CheckGearVR_Button()
    {
        accumTime += Time.deltaTime;
        if (Input.GetMouseButton(0))
        {
            if (menuManager.demoState == MenuManager.DemoState.MOVEMENT_SENSORS)
            {
                //float fIny = Input.GetAxis("Mouse Y");
                tx_YPos.text = GearVRInput.GetAxisX.ToString("F2");

                buttonDownPrev = true;

                if (accumTime > 0.4f)
                {
                    if (GearVRInput.GetAxisX < -0.9f)
                    {

                        if (--curr_display < 0) curr_display = 35;//EDIT HERE

                    }
                    else if (GearVRInput.GetAxisX > 0.9f)
                    {
                        if (++curr_display > 35) curr_display = 0;
                    }
                    accumTime = 0;
                }

                switch (curr_display)
                {
                    case 0:
                        {
                            Title.text = "0) Accelerometer XYZ";
                            SensInput[0].input = Inputs.Input.Accel_X;
                            GraphTrace[0].color = Color.red;
                            SensInput[1].input = Inputs.Input.Accel_Y;
                            GraphTrace[1].color = Color.green;
                            SensInput[2].input = Inputs.Input.Accel_Z;
                            GraphTrace[2].color = Color.blue;
                            iSens_Cnt = 3;
                            break;
                        }
                    case 1:
                        {
                            Title.text = "1) Accelerometer X";
                            SensInput[0].input = Inputs.Input.Accel_X;
                            GraphTrace[0].color = Color.red;
                            iSens_Cnt = 1;
                            break;
                        }
                    case 2:
                        {
                            Title.text = "2) Accelerometer Y";
                            SensInput[0].input = Inputs.Input.Accel_Y;
                            GraphTrace[0].color = Color.green;
                            iSens_Cnt = 1;
                            break;
                        }
                    case 3:
                        {
                            Title.text = "3) Accelerometer Z";
                            SensInput[0].input = Inputs.Input.Accel_Z;
                            GraphTrace[0].color = Color.blue;
                            iSens_Cnt = 1;
                            break;
                        }
                    case 4:
                        {
                            Title.text = "4) Gyro Attitude Quaternion";
                            SensInput[0].input = Inputs.Input.Gyro_Att_qX;
                            GraphTrace[0].color = Color.red;
                            SensInput[1].input = Inputs.Input.Gyro_Att_qY;
                            GraphTrace[1].color = Color.green;
                            SensInput[2].input = Inputs.Input.Gyro_Att_qZ;
                            GraphTrace[2].color = Color.blue;
                            //SensInput[3].input = Inputs.Input.Gyro_Att_qZ;
                            //GraphTrace[3].color = Color.magenta;
                            iSens_Cnt = 3;
                            break;
                        }
                    case 5:
                        {
                            Title.text = "5) Gyro Attitude Quat X";
                            SensInput[0].input = Inputs.Input.Gyro_Att_qX;
                            GraphTrace[0].color = Color.red;
                            iSens_Cnt = 1;
                            break;
                        }
                    case 6:
                        {
                            Title.text = "6) Gyro Attitude Quat Y";
                            SensInput[0].input = Inputs.Input.Gyro_Att_qY;
                            GraphTrace[0].color = Color.green;
                            iSens_Cnt = 1;
                            break;
                        }
                    case 7:
                        {
                            Title.text = "7) Gyro Attitude Quat Z";
                            SensInput[0].input = Inputs.Input.Gyro_Att_qZ;
                            GraphTrace[0].color = Color.blue;
                            iSens_Cnt = 1;
                            break;
                        }
                    case 8:
                        {
                            Title.text = "8) Gyro Attitude Quat W";
                            SensInput[0].input = Inputs.Input.Gyro_Att_qW;
                            GraphTrace[0].color = Color.magenta;
                            iSens_Cnt = 1;
                            break;
                        }

                    case 9:
                        {
                            Title.text = "9) Gyro Attitude Euler";
                            SensInput[0].input = Inputs.Input.Gyro_Att_euX;
                            GraphTrace[0].color = Color.red;
                            SensInput[1].input = Inputs.Input.Gyro_Att_euY;
                            GraphTrace[1].color = Color.green;
                            SensInput[2].input = Inputs.Input.Gyro_Att_euZ;
                            GraphTrace[2].color = Color.blue;
                            iSens_Cnt = 3;
                            break;
                        }
                    case 10:
                        {
                            Title.text = "10) Gyro Attitude Euler X";
                            SensInput[0].input = Inputs.Input.Gyro_Att_euX;
                            GraphTrace[0].color = Color.red;
                            iSens_Cnt = 1;
                            break;
                        }
                    case 11:
                        {
                            Title.text = "11) Gyro Attitude Euler Y";
                            SensInput[0].input = Inputs.Input.Gyro_Att_euY;
                            GraphTrace[0].color = Color.green;
                            iSens_Cnt = 1;
                            break;
                        }
                    case 12:
                        {
                            Title.text = "12) Gyro Attitude Euler Z";
                            SensInput[0].input = Inputs.Input.Gyro_Att_euZ;
                            GraphTrace[0].color = Color.blue;
                            iSens_Cnt = 1;
                            break;
                        }
                    case 13:
                        {
                            Title.text = "13) Gyro Gravity";
                            SensInput[0].input = Inputs.Input.Gyro_Grav_X;
                            GraphTrace[0].color = Color.red;
                            SensInput[1].input = Inputs.Input.Gyro_Grav_Y;
                            GraphTrace[1].color = Color.green;
                            SensInput[2].input = Inputs.Input.Gyro_Grav_Z;
                            GraphTrace[2].color = Color.blue;
                            iSens_Cnt = 3;
                            break;
                        }
                    case 14:
                        {
                            Title.text = "14) Gyro Gravity X";
                            SensInput[0].input = Inputs.Input.Gyro_Grav_X;
                            GraphTrace[0].color = Color.red;
                            iSens_Cnt = 1;
                            break;
                        }
                    case 15:
                        {
                            Title.text = "15) Gyro Gravity Y";
                            SensInput[0].input = Inputs.Input.Gyro_Grav_Y;
                            GraphTrace[0].color = Color.green;
                            iSens_Cnt = 1;
                            break;
                        }
                    case 16:
                        {
                            Title.text = "16) Gyro Gravity Z";
                            SensInput[0].input = Inputs.Input.Gyro_Grav_Z;
                            GraphTrace[0].color = Color.blue;
                            iSens_Cnt = 1;
                            break;
                        }
                    case 17:
                        {
                            Title.text = "17) Gyro Rotation Rate";
                            SensInput[0].input = Inputs.Input.Gyro_Rota_Rate_X;
                            GraphTrace[0].color = Color.red;
                            SensInput[1].input = Inputs.Input.Gyro_Rota_Rate_Y;
                            GraphTrace[1].color = Color.green;
                            SensInput[2].input = Inputs.Input.Gyro_Rota_Rate_Z;
                            GraphTrace[2].color = Color.blue;
                            iSens_Cnt = 3;
                            break;
                        }
                    case 18:
                        {
                            Title.text = "18) Gyro Rotation Rate X";
                            SensInput[0].input = Inputs.Input.Gyro_Rota_Rate_X;
                            GraphTrace[0].color = Color.red;
                            iSens_Cnt = 1;
                            break;
                        }
                    case 19:
                        {
                            Title.text = "19) Gyro Rotation Rate Y";
                            SensInput[0].input = Inputs.Input.Gyro_Rota_Rate_Y;
                            GraphTrace[0].color = Color.green;
                            iSens_Cnt = 1;
                            break;
                        }
                    case 20:
                        {
                            Title.text = "20) Gyro Rotation Rate Z";
                            SensInput[0].input = Inputs.Input.Gyro_Rota_Rate_Z;
                            GraphTrace[0].color = Color.blue;
                            iSens_Cnt = 1;
                            break;
                        }
                    case 21:
                        {
                            Title.text = "21) Gyro Rotation Rate UnBiased";
                            SensInput[0].input = Inputs.Input.Gyro_Rota_Rate_UB_X;
                            GraphTrace[0].color = Color.red;
                            SensInput[1].input = Inputs.Input.Gyro_Rota_Rate_UB_Y;
                            GraphTrace[1].color = Color.green;
                            SensInput[2].input = Inputs.Input.Gyro_Rota_Rate_UB_Z;
                            GraphTrace[2].color = Color.blue;
                            iSens_Cnt = 3;
                            break;
                        }
                    case 22:
                        {
                            Title.text = "22) Gyro Rotation Rate UnBiased X";
                            SensInput[0].input = Inputs.Input.Gyro_Rota_Rate_UB_X;
                            GraphTrace[0].color = Color.red;
                            iSens_Cnt = 1;
                            break;
                        }
                    case 23:
                        {
                            Title.text = "23) Gyro Rotation Rate UnBiased Y";
                            SensInput[0].input = Inputs.Input.Gyro_Rota_Rate_UB_Y;
                            GraphTrace[0].color = Color.green;
                            iSens_Cnt = 1;
                            break;
                        }
                    case 24:
                        {
                            Title.text = "24) Gyro Rotation Rate UnBiased Z";
                            SensInput[0].input = Inputs.Input.Gyro_Rota_Rate_UB_Z;
                            GraphTrace[0].color = Color.blue;
                            iSens_Cnt = 1;
                            break;
                        }
                    case 25:
                        {
                            Title.text = "25) Gyro Acceleration";
                            SensInput[0].input = Inputs.Input.Gyro_Accel_X;
                            GraphTrace[0].color = Color.red;
                            SensInput[1].input = Inputs.Input.Gyro_Accel_Y;
                            GraphTrace[1].color = Color.green;
                            SensInput[2].input = Inputs.Input.Gyro_Accel_Z;
                            GraphTrace[2].color = Color.blue;
                            iSens_Cnt = 3;
                            break;
                        }
                    case 26:
                        {
                            Title.text = "26) Gyro Acceleration X";
                            SensInput[0].input = Inputs.Input.Gyro_Accel_X;
                            GraphTrace[0].color = Color.red;
                            iSens_Cnt = 1;
                            break;
                        }
                    case 27:
                        {
                            Title.text = "27) Gyro Acceleration Y";
                            SensInput[0].input = Inputs.Input.Gyro_Accel_Y;
                            GraphTrace[0].color = Color.green;
                            iSens_Cnt = 1;
                            break;
                        }
                    case 28:
                        {
                            Title.text = "28) Gyro Acceleration Z";
                            SensInput[0].input = Inputs.Input.Gyro_Accel_Z;
                            GraphTrace[0].color = Color.blue;
                            iSens_Cnt = 1;
                            break;
                        }
                    case 29:
                        {
                            Title.text = "29) Magnetic Heading Accuracy";
                            SensInput[0].input = Inputs.Input.Mag_Heading_Accuracy;
                            GraphTrace[0].color = Color.blue;
                            iSens_Cnt = 1;
                            break;
                        }
                    case 30:
                        {
                            Title.text = "30) Magnetic Heading";
                            SensInput[0].input = Inputs.Input.Mag_Heading;
                            GraphTrace[0].color = Color.blue;
                            iSens_Cnt = 1;
                            break;
                        }
                    case 31:
                        {
                            Title.text = "31) Magnetic Raw Vector XYZ";
                            SensInput[0].input = Inputs.Input.Mag_Raw_Vec_X;
                            GraphTrace[0].color = Color.red;
                            SensInput[1].input = Inputs.Input.Mag_Raw_Vec_Y;
                            GraphTrace[1].color = Color.green;
                            SensInput[2].input = Inputs.Input.Mag_Raw_Vec_Z;
                            GraphTrace[2].color = Color.blue;
                            iSens_Cnt = 3;
                            break;
                        }
                    case 32:
                        {
                            Title.text = "32) Magnetic Raw Vector X";
                            SensInput[0].input = Inputs.Input.Mag_Raw_Vec_X;
                            GraphTrace[0].color = Color.red;
                            iSens_Cnt = 1;
                            break;
                        }
                    case 33:
                        {
                            Title.text = "33) Magnetic Raw Vector Y";
                            SensInput[0].input = Inputs.Input.Mag_Raw_Vec_Y;
                            GraphTrace[0].color = Color.green;
                            iSens_Cnt = 1;
                            break;
                        }
                    case 34:
                        {
                            Title.text = "34) Magnetic Raw Vector Z";
                            SensInput[0].input = Inputs.Input.Mag_Raw_Vec_Z;
                            GraphTrace[0].color = Color.blue;
                            iSens_Cnt = 1;
                            break;
                        }
                    case 35:
                        {
                            Title.text = "35) Magnetic True Heading";
                            SensInput[0].input = Inputs.Input.Mag_True_Heading;
                            GraphTrace[0].color = Color.blue;
                            iSens_Cnt = 1;
                            break;
                        }
                }
            }
        }
        //}
        //else
        //{
        //    buttonDownPrev = false;
        //}
    }

	// Update is called once per frame
	void Update ()
    {
        CheckGearVR_Button();
        Get_Lists();

        fElapsedTime += Time.deltaTime;

        GetComponent<RectTransform>().GetWorldCorners(vCorners);
        vx = vCorners[3] - vCorners[0];
        vy = vCorners[1] - vCorners[0];
        Width = vx.magnitude;
        Height = vy.magnitude;

        vx.Normalize();
        vy.Normalize();

        //if(bCan_Render || Panel_State == GF_Manager.Panel_State.FOCUS)
        //{
            DrawTrace();
            //bCan_Render = false;
        //}
   
        if (pHeight != Height || pWidth != Width)
        {
            vx.Normalize();
            vy.Normalize();

            //Panel Border
            //Border_Points.points3[0] = vCorners[0];
            //Border_Points.points3[1] = vCorners[1];
            //Border_Points.points3[2] = vCorners[2];
            //Border_Points.points3[3] = vCorners[3];
            //Border_Points.points3[4] = vCorners[0];

            vCenter = Vector3.zero;
            for (int i = 0; i < 4; i++)
            {
                vCenter += vCorners[i];
            }
            vCenter /= 4.0f;

            //Graph Axis
            //GraphAxis.points3[0] = vCenter - vx * Width/2.0f;
            //GraphAxis.points3[1] = vCenter + vx * Width/2.0f;

            pWidth = Width;
            pHeight = Height;
        }
    }
}

//float x = GetComponent<RectTransform>().rect.x;
//float y = GetComponent<RectTransform>().rect.y;
//float xMax = GetComponent<RectTransform>().rect.xMax;
//float yMax = GetComponent<RectTransform>().rect.yMax;
//float xMin = GetComponent<RectTransform>().rect.xMin;
//float yMin = GetComponent<RectTransform>().rect.yMin;
//float width = GetComponent<RectTransform>().rect.width;
//float height = GetComponent<RectTransform>().rect.height;

 

ghjgkh71

Issuing Shell Commands
You can use the shell command to issue commands, with or without entering the adb remote shell on the emulator/device. To issue a single command without entering a remote shell, use the shell command like this:

adb [-d|-e|-s <serialNumber>] shell <shell_command>
Or enter a remote shell on an emulator/device like this:

adb [-d|-e|-s <serialNumber>] shell