Ejemplo n.º 1
0
    // Update is called once per frame
    void FixedUpdate()
    {
        if (vocb == null)
        {
            vocb = hand.IndexTip.GetComponent <VibrateOnCollideBehaviour>();
        }

        if (vocb != null && indexFTC != null && (indexFTC.touching != null && indexFTC.touching.Equals(knob)))
        {
            string toDisplay = vocb.VibrationEffect + " " + knob.getVibrationEffect() + " " + knob.VibrationEffect;
            if (vocb.VibrationEffect != null && vocb.VibrationEffect.Value != knob.getVibrationEffect())
            {
                toDisplay += "\r\nERROR";
            }
            MaestroBLEUI.SetRightText(toDisplay);

            /*if (!toDisplay.Equals(lastDisplayed))
             * {
             *  Debug.Log(toDisplay);
             *  lastDisplayed = toDisplay;
             *
             *  if (vocb.VibrationEffect != null && vocb.VibrationEffect.Value != knob.getVibrationEffect())
             *  {
             *      Debug.Log("WHOA THERE");
             *  }
             * }*/
        }
    }
Ejemplo n.º 2
0
    // Start is called before the first frame update
    void Start()
    {
        if (instance == null)
        {
            instance = this;
        }

        leftHistory  = new List <Vector3>();
        rightHistory = new List <Vector3>();

        watcher.gameObject.SetActive(false);
        left.gameObject.SetActive(false);
        right.gameObject.SetActive(false);
        process.gameObject.SetActive(false);
        leftConnected.gameObject.SetActive(false);
        rightConnected.gameObject.SetActive(false);

        // Find active left/right hands
        MaestroHand[] hands = GameObject.FindObjectsOfType <MaestroHand>();
        foreach (MaestroHand hand in hands)
        {
            if (hand.whichHand == WhichHand.LeftHand)
            {
                if (leftHand == null)
                {
                    leftHand = hand;
                }
                else
                {
                    continue;
                }
            }
            else
            {
                if (rightHand == null)
                {
                    rightHand = hand;
                }
                else
                {
                    continue;
                }
            }
        }

        // Get gloves
        rightGlove = rightHand.gameObject.GetComponentInParent <MaestroGloveBehaviour>();
        leftGlove  = leftHand.gameObject.GetComponentInParent <MaestroGloveBehaviour>();

        // Find main camera
        mainCamera = GameObject.FindObjectOfType <Camera>();
        if (mainCamera == null)
        {
            Debug.LogError("Main Camera not found!");
        }

        // Spawn panels
        leftPanel  = Instantiate(panelPrefab);
        rightPanel = Instantiate(panelPrefab);

        // Get Text meshes
        leftText      = leftPanel.GetComponentInChildren <TextMesh>();
        leftText.text = "Please wait...\r\nLeft Connecting";
        rightText     = rightPanel.GetComponentInChildren <TextMesh>();

        // Init history
        RecordHistory();

        // Init panel positions
        OrientPanel(leftPanel, getAverage(leftHistory));
        OrientPanel(rightPanel, getAverage(rightHistory));
    }