GetDown() public static method

Gets the current down state of the given virtual button mask with the given controller mask. Returns true if any masked button was pressed this frame on any masked controller and no masked button was previously down last frame.
public static GetDown ( Button, virtualMask, Controller, controllerMask = Controller.Active ) : bool
virtualMask Button,
controllerMask Controller,
return bool
Example #1
0
    void Update()
    {
        if (startTimer)
        {
            timer -= Time.deltaTime;
            if (timer <= 0f)
            {
                startTimer = false;
            }
        }
        // If get an input right arrow, advance to the next scene
        if (Input.GetKeyUp(KeyCode.RightArrow))
        {
            GameManager.GM.changeScene(1);
        }
        // If get an input left arrwo, devance to the last scene
        if (Input.GetKeyUp(KeyCode.LeftArrow))
        {
            GameManager.GM.changeScene(-1);
        }

        if (Input.GetKeyUp(KeyCode.Space))
        {
            GameManager.GM.BlackScreenEnclosure.SetActive(!GameManager.GM.BlackScreenEnclosure.activeSelf);
            GameManager.GM.BlackScreenEnclosure2.SetActive(!GameManager.GM.BlackScreenEnclosure2.activeSelf);
        }
        if (GameManager.GM.PlayerActionLock && !GameManager.GM.ClickedOnce && timer <= 0f)
        {
            if (OVRInput.GetDown(button))
            {
                timer = 1f;
                GameManager.GM.ClickedOnce = true;
                GameManager.GM.BlackScreenEnclosure.SetActive(false);
                GameManager.GM.BlackScreenEnclosure2.SetActive(false);
                GameManager.GM.CalculateResult(player_hand, playerhand_cube);
            }
        }
    }
Example #2
0
    // Update is called once per frame
    void Update()
    {
        timeLeftToStart -= Time.deltaTime;
        timeEnemy       -= Time.deltaTime;
        if (timeLeftToStart < 0 && timeOut == false)
        {
            DissolveObjects();
            timeOut = true;
        }
        if (timeEnemy < 0)
        {
            enemyAppears = true;
            TurnOnLight();
            AppearEnemy();
        }

        if (timeOut)
        {
            DissolveAction();
        }

        if (gameOver)
        {
            timeChangeScreen -= Time.deltaTime;
            Color tempColor = gameOverImage.color;
            tempColor.a        += 0.5f * Time.deltaTime;
            gameOverImage.color = tempColor;
            if (timeChangeScreen <= 0)
            {
                // SceneManager.LoadScene("GameOver"); For Next future
                Application.Quit();
            }
        }
        if (Input.GetKey("escape") || OVRInput.GetDown(OVRInput.Button.Start))
        {
            Application.Quit();
        }
    }
    // Update is called once per frame
    void Update()
    {
        RaycastHit hitInfo = new RaycastHit();
        Ray        ray     = Camera.main.ScreenPointToRay(Input.mousePosition);

        //OnMouseDown
        //if(OVRInput.GetDown(OVRInput.Button.One))  Replace for Oculus input
        if (Input.GetMouseButtonDown(0))
        {
            if (Physics.Raycast(ray, out hitInfo))
            {
                selectObject = hitInfo;
                Debug.Log("click" + hitInfo.collider.name);
                isSelect = true;

                int id = this.GetInstanceID();
                Debug.Log(hitInfo.transform.gameObject.GetInstanceID() + "in update");
            }
        }

        if ((Input.GetKeyDown(KeyCode.P) || OVRInput.GetDown(OVRInput.RawButton.DpadUp)) && isSelect)
        {
            Debug.Log("Activate position modification of object" + selectObject.collider.name);
        }
        if ((Input.GetKeyDown(KeyCode.S) || OVRInput.GetDown(OVRInput.RawButton.DpadDown)) && isSelect)
        {
            Debug.Log("Activate size modification of object" + selectObject.collider.name);
            isSelect = false;
        }
        if ((Input.GetKeyDown(KeyCode.T) || OVRInput.GetDown(OVRInput.RawButton.DpadRight)) && isSelect)
        {
            Debug.Log("Activate color modification of object" + selectObject.collider.name);
        }
        if ((Input.GetKeyDown(KeyCode.U) || OVRInput.GetDown(OVRInput.RawButton.DpadLeft)) && isSelect)
        {
            Debug.Log("Activate rotation modification of object" + selectObject.collider.name);
        }
    }
Example #4
0
    private bool AreAnyStartRecordKeysDown()
    {
        if (_next || _skip)
        {
            _next = false;
            return(true);
        }
        if (Input.GetKey(KeyCode.Escape))
        {
            _skip = true;
            return(true);
        }
        var sc = SuperController.singleton;

        if (sc.isOVR)
        {
            if (OVRInput.GetDown(OVRInput.Button.One, OVRInput.Controller.Touch))
            {
                return(true);
            }
            if (OVRInput.GetDown(OVRInput.Button.Three, OVRInput.Controller.Touch))
            {
                return(true);
            }
        }
        if (sc.isOpenVR)
        {
            if (sc.selectAction.stateDown)
            {
                return(true);
            }
        }
        if (Input.GetKeyDown(KeyCode.Space))
        {
            return(true);
        }
        return(false);
    }
    // Update is called once per frame
    void Update()
    {
        //Press One touch!
        if (OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger) || Input.GetButtonDown("Fire1"))
        {
            //The Position what we detect!
            RaycastHit hit;
            if (Physics.Raycast(controller.transform.position, controller.transform.forward, out hit))
            {
                src.Play();
                line.enabled = true;
                //Start Line Position!
                line.SetPosition(0, controller.transform.position);
                //End Line Position!
                target = hit.point;
                line.SetPosition(1, target);
                //Addforce to let player move
                player.AddForce((target - controller.transform.position).normalized * 20f);

                //Texture offset效果初始化
                line.material.mainTextureOffset = Vector2.zero;
            }
            //Keep Press!
        }
        else if (OVRInput.Get(OVRInput.Button.PrimaryIndexTrigger) || Input.GetButton("Fire1") && line.enabled)
        {
            //src.Play();
            line.SetPosition(0, controller.transform.position);
            line.material.mainTextureOffset = new Vector2(line.material.mainTextureOffset.x + Random.Range(-.01f, 0.05f), 0f);  //Texture Offset 效果

            player.AddForce((target - controller.transform.position).normalized * 20f);
            //Release!
        }
        else
        {
            line.enabled = false;
        }
    }
Example #6
0
    void controlSubida()
    {
        if (OVRInput.GetDown(OVRInput.Button.Two, OVRInput.Controller.LTouch))
        {
            if (personajeMontado == false && GAME.dragonMontura && Age == 1 && visible && activo)
            {
                montar();
            }
            else if (personajeMontado)
            {
                desmontar();
            }
        }

        if (OVRInput.GetDown(OVRInput.Button.One, OVRInput.Controller.LTouch))
        {
            if (personajeMontado)
            {
                malbersInput.volar();
            }
        }

        if (OVRInput.Get(OVRInput.Button.One, OVRInput.Controller.RTouch))
        {
            if (personajeMontado)
            {
                malbersInput.subirAltura();
            }
        }

        if (OVRInput.Get(OVRInput.Button.Two, OVRInput.Controller.RTouch))
        {
            if (personajeMontado)
            {
                malbersInput.bajarAltura();
            }
        }
    }
    private void Raycast_Update()
    {
        if (OVRInput.GetDown(OVRInput.Button.SecondaryHandTrigger) || Input.GetKeyDown(KeyCode.Z))
        {
            fsm.ChangeState(RaycastStates.Idle);
        }
        else
        {
            RaycastHit hit;
            this.line.SetPosition(0, transform.position);
            Debug.Log("instate Object");
            if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), out hit,
                                5000, LayerMask.GetMask("Selected")))
            {
                Debug.Log("hit Object");
                this.line.SetPosition(1, hit.point);
                if (OVRInput.GetDown(OVRInput.Button.SecondaryIndexTrigger) || Input.GetKeyDown(KeyCode.C))
                {
                    //if(hit.transform.GetComponent<Renderer>() != null)
                    //{
                    this.grabbedObject = hit.transform;

                    /*}
                     * else
                     * {
                     *  this.grabbedObject = hit.transform.parent.transform;
                     * }*/
                    Debug.Log(this.grabbedObject);
                    fsm.ChangeState(RaycastStates.GrabbedObject);
                }
            }
            else
            {
                Debug.Log("no hit Object");
                this.line.SetPosition(1, transform.TransformDirection(Vector3.forward) * 5000);
            }
        }
    }
Example #8
0
    // Update is called once per frame
    void Update()
    {
        if (OVRInput.GetDown(OVRInput.Button.PrimaryThumbstickLeft) || OVRInput.GetDown(OVRInput.Button.SecondaryThumbstickLeft))
        {
            if (i == 0)
            {
                i = songList.Capacity - 1;
            }
            else
            {
                i--;
            }
            Debug.Log(i);

            ui.curSong.text   = songList[i].songTitle;
            ui.curArtist.text = songList[i].artistName;
            aud.clip          = songList[i].clip;
            ui.label.color    = songList[i].labelColor;
        }
        if (OVRInput.GetDown(OVRInput.Button.PrimaryThumbstickRight) || OVRInput.GetDown(OVRInput.Button.SecondaryThumbstickRight))
        {
            if (i == songList.Capacity - 1)
            {
                i = 0;
            }
            else
            {
                i++;
            }

            Debug.Log(i);

            ui.curSong.text   = songList[i].songTitle;
            ui.curArtist.text = songList[i].artistName;
            aud.clip          = songList[i].clip;
            ui.label.color    = songList[i].labelColor;
        }
    }
Example #9
0
    void Update()
    {
        Vector2 touchValue = OVRInput.Get(OVRInput.Axis2D.PrimaryTouchpad);

        if (OVRInput.GetDown(OVRInput.Touch.PrimaryTouchpad))
        {
            if (touchValue.y > 0.5 && touchValue.x > -0.25 && touchValue.x < 0.25)
            {
                if (!(Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), 1)))
                {
                    transform.position += transform.forward;
                }
            }
            else if (touchValue.x > 0.5 && touchValue.y > -0.25 && touchValue.y < 0.25)
            {
                transform.Rotate(new Vector3(0, 90, 0));
            }
            else if (touchValue.x < 0.5 && touchValue.y > -0.25 && touchValue.y < 0.25)
            {
                transform.Rotate(new Vector3(0, -90, 0));
            }
        }
        if (OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger) || Input.GetKeyDown(KeyCode.L))
        {
            if (candle.enabled)
            {
                candle.enabled   = false;
                player.lightIsOn = false;
                blowingOut.Play();
            }
            else
            {
                candle.enabled   = true;
                player.lightIsOn = true;
                igniting.Play();
            }
        }
    }
Example #10
0
    private void OnTriggerStay(Collider other)
    {
        //Controlo que no se cargue la escena más de una vez
        if (!isLoadingInterval)
        {
            //Si tienes la llave en la mano, puedes acceder a la siguiente escena
            if (other.CompareTag("Hands") &&
                StartGameKey)
            {
                //Aparece Texto
                _text.gameObject.SetActive(true);
                _text.text  = "Pulsa táctil izquierdo para empezar";
                _text.color = Color.white;

                //activa la carga de la siguiente escena con el táctil del mando
                if (OVRInput.GetDown(OVRInput.Touch.PrimaryThumbRest))
                {
                    isLoadingInterval = true;
                    _carBeep.PlayOneShot(_carBeep.clip);
                    _light1.SetActive(true);
                    _light2.SetActive(true);
                    _chara.enabled = false;
                    _garageAnimator.SetTrigger("OpenDoor");
                    _gameTitle.SetTrigger("GameTitle");
                    _wall.gameObject.SetActive(true);
                }
            }
        }

        //Si no se tiene la llave, salta el aviso
        if (other.CompareTag("Hands") &&
            !StartGameKey)
        {
            _text.gameObject.SetActive(true);
            _text.text  = "Necesitas la llave del coche";
            _text.color = Color.red;
        }
    }
Example #11
0
    // Update is called once per frame
    void Update()
    {
        RaycastHit hit;

        if (Physics.Raycast(transform.position, transform.forward, out hit))
        {
            // mengecek object yang dideteksi harus memiliki collider
            if (hit.collider)
            {
                // pastikan object yang dideteksi memiliki tag Monster
                if (hit.transform.tag.Equals("Monster"))
                {
                    hit.transform.GetComponent <RespondButton>().SetHit();

                    // ketika user menekan/klik tombol
                    if (OVRInput.GetDown(OVRInput.RawButton.A) || Input.GetKeyDown(KeyCode.Space))
                    {
                        hit.transform.GetComponent <RespondButton>().SetAttack();
                    }
                }
            }
        }
    }
    // Update is called once per frame
    private void Update()
    {
        if (WarpCheck)
        {
            if (warp)//カメラに写っている時
            {
                //Debug.Log("miteru");
                Effect.SetActive(true);
                if (OVRInput.GetDown(OVRInput.RawButton.B))
                {
                    object1.transform.position = this.transform.position;
                }
            }
            else//カメラに写ってない時
            {
                Effect.SetActive(false);
            }
        }



        warp = false;
    }
Example #13
0
    // Update is called once per frame
    void Update()
    {
        if (firstPanelBool == true)
        {
            timer.text = ChaseLocation.timeLeft.ToString("F2") + "s";

            if (ChaseLocation.timed == false)
            {
                firstPanelBool = false;

                StartSecond();
            }
        }

        else if (secondPanelBool == true)
        {
            if (OVRInput.GetDown(OVRInput.Button.Two))
            {
                StartThird();
                secondPanelBool = false;
            }
        }
    }
Example #14
0
    public void ShootRaycast()
    {
        RaycastHit hit;

        Debug.DrawRay(transform.position, Vector3.forward, Color.magenta, 0.1f);
        if (Physics.Raycast(transform.position, transform.forward, out hit))
        {
            if (hit.collider)
            {
                LZR.SetPosition(1, new Vector3(0, 0, hit.distance));
                Status.text = hit.collider.gameObject.name + " hit! Distance: " + hit.distance;
                if (OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger))
                {
                    TriggerSelected.text = "Trigger clicked";
                    hit.collider.gameObject.GetComponent <CubeChanger>().Randomjob(hit.point);
                }
            }
            else
            {
                LZR.SetPosition(1, new Vector3(0, 0, 1000));
            }
        }
    }
Example #15
0
 // Update is called once per frame
 void Update()
 {
     if (OVRInput.GetDown(OVRInput.Button.One))
     {
         SceneManager.LoadScene(1);
     }
     else if (OVRInput.GetDown(OVRInput.Button.Two))
     {
         SceneManager.LoadScene(2);
     }
     else if (OVRInput.GetDown(OVRInput.Button.Three))
     {
         SceneManager.LoadScene(3);
     }
     else if (OVRInput.GetDown(OVRInput.Button.Four))
     {
         SceneManager.LoadScene(4);
     }
     else if (OVRInput.GetDown(OVRInput.Button.Start))
     {
         SceneManager.LoadScene(5);
     }
 }
Example #16
0
 // Update is called once per frame
 void Update()
 {
     if (OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger) || Input.GetMouseButtonDown(0))
     {
         if (antibodyPrefab != null)
         {
             GameObject spawnedAntibody = GameObject.Instantiate(antibodyPrefab, lhand.transform.position, lhand.transform.rotation);
             Rigidbody  rb = spawnedAntibody.GetComponent <Rigidbody>();
             rb.isKinematic = false;
             rb.AddForce(spawnedAntibody.transform.forward * force);
         }
     }
     if (OVRInput.GetDown(OVRInput.Button.SecondaryIndexTrigger) || Input.GetMouseButtonDown(1))
     {
         if (antibodyPrefab != null)
         {
             GameObject spawnedAntibody = GameObject.Instantiate(antibodyPrefab, rhand.transform.position, rhand.transform.rotation);
             Rigidbody  rb = spawnedAntibody.GetComponent <Rigidbody>();
             rb.isKinematic = false;
             rb.AddForce(spawnedAntibody.transform.forward * force);
         }
     }
 }
Example #17
0
    bool laser_press()
    {
        GameObject pick_hand;

        if (ovr_grab.isGrabbed)
        {
            pick_hand = ovr_grab.grabbedBy.gameObject;
        }
        else
        {
            return(false);
        }

        if (pick_hand == lefthand)
        {
            return(OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger, OVRInput.Controller.LTouch));
        }
        else if (pick_hand == righthand)
        {
            return(OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger, OVRInput.Controller.RTouch));
        }
        return(false);
    }
 // Update is called once per frame
 void Update()
 {
     if (OVRInput.GetDown(OVRInput.RawButton.RHandTrigger))  // yama 180201 右中指トリガーを押したか判定
     {
         if (callib_count == 0)
         {
             rHand_pos = transform.TransformPoint(OVRInput.GetLocalControllerPosition(OVRInput.Controller.RTouch));
             //Debug.Log(rHand_pos);
             callib_count++;
             Set_Position();
         }
     }
     if (OVRInput.GetDown(OVRInput.RawButton.LHandTrigger))  // yama 180201 左中指トリガーを押したか判定
     {
         if (callib_count == 1)
         {
             lHand_pos = transform.TransformPoint(OVRInput.GetLocalControllerPosition(OVRInput.Controller.LTouch));
             //Debug.Log(lHand_pos);
             callib_count++;
             Set_Position();
         }
     }
 }
Example #19
0
        private void SendButtonEvents(OVRInput.Controller ovrController, int deviceIndex)
        {
            foreach (OVRInput.Button button in Enum.GetValues(typeof(OVRInput.Button)))
            {
                int buttonIndex = GetButtonIndex(button);
                if (buttonIndex >= 0)
                {
                    bool isDown = OVRInput.GetDown(button, ovrController);
                    bool isUp   = OVRInput.GetUp(button, ovrController);

                    if (isDown || isUp)
                    {
                        var inputEvent = InputSystem.CreateEvent <GenericControlEvent>();
                        inputEvent.deviceType   = typeof(VRInputDevice);
                        inputEvent.deviceIndex  = deviceIndex;
                        inputEvent.controlIndex = buttonIndex;
                        inputEvent.value        = isDown ? 1.0f : 0.0f;

                        InputSystem.QueueEvent(inputEvent);
                    }
                }
            }
        }
Example #20
0
 void HandleInput()
 {
     if (moveButton != null && selectButton != null)
     {
         if (OVRInput.GetDown(OVRInput.Button.PrimaryTouchpad))
         {
             if (ModeMenuStateManager.instance.currentMode == 0)
             {
                 ModeMenuStateManager.instance.SwitchMode(1);
                 selectButton.Click();
             }
             else
             {
                 ModeMenuStateManager.instance.SwitchMode(0);
                 moveButton.Click();
             }
         }
     }
     recenterPressed = OVRInput.GetControllerWasRecentered();
     #if UNITY_EDITOR
     recenterPressed = Input.GetKeyDown(KeyCode.Return);
     #endif
 }
 void Shot()
 {
     if (OVRInput.GetDown(OVRInput.RawButton.B) && CheckGrab())
     {
         if (smog[0].isPlaying == false)
         {
             for (int i = 0; i < 12; i++)
             {
                 smog[i].Play();
             }
         }
     }
     else if (OVRInput.GetUp(OVRInput.RawButton.B) && CheckGrab())
     {
         if (smog[0].isPlaying == true)
         {
             for (int i = 0; i < 12; i++)
             {
                 smog[i].Stop();
             }
         }
     }
 }
Example #22
0
    private void VRInput()
    {
        RaycastHit hit;

        if (Physics.Raycast(_oculusRemote.position, _oculusRemote.forward, out hit, Mathf.Infinity))
        {
            if (hit.collider.CompareTag("UIPanel") && _isTargetted == false)
            {
                _hitPanelCol = hit.collider;
                _isTargetted = true;
                _levelCompletedManager.Over(_hitPanelCol);
            }
            else if (_isTargetted && OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger, OVRInput.Controller.RTrackedRemote))
            {
                _levelCompletedManager.Select(_hitPanelCol);
            }
        }
        else if (_isTargetted)
        {
            _isTargetted = false;
            _levelCompletedManager.Exit(_hitPanelCol);
        }
    }
Example #23
0
    // Update is called once per frame
    void Update()
    {
        totalTime      -= Time.deltaTime;
        totalTimeLimit -= Time.deltaTime;

        if (GoFromArduino == true && totalTime <= 0)
        {
            Debug.Log("Scene Change");
            SceneManager.LoadScene("Explanation_Scene");
        }

        if (OVRInput.GetDown(OVRInput.RawButton.LIndexTrigger) && totalTime <= 0)
        {
            Debug.Log("Scene Change");
            SceneManager.LoadScene("Explanation_Scene");
        }

        if (totalTimeLimit <= 0)
        {
            Debug.Log("Scene Change");
            SceneManager.LoadScene("Explanation_Scene");
        }
    }
 private void testPrints()
 {
     if (OVRInput.GetDown(OVRInput.RawButton.RHandTrigger))
     {
         Debug.Log("the Right grip has been pressed");
     }
     if (OVRInput.GetDown(OVRInput.RawButton.RThumbstickDown))
     {
         Debug.Log("the Right thumbstick has been moved down");
     }
     if (OVRInput.GetDown(OVRInput.RawButton.RThumbstickUp))
     {
         Debug.Log("the Right thumbstick has been moved up");
     }
     if (OVRInput.GetDown(OVRInput.RawButton.RThumbstickRight))
     {
         Debug.Log("the Right thumbstick has been moved to the right");
     }
     if (OVRInput.GetDown(OVRInput.RawButton.RThumbstickLeft))
     {
         Debug.Log("the Right thumbstick has been moved to the left");
     }
 }
Example #25
0
        private void Update()
        {
            var controller = grabber.Controller;

            if (OVRInput.GetDown(trigger, controller))
            {
                var grabbable = grabber.grabbedObject;
                if (grabbable != null && grabbable.allowInventory)
                {
                    if (snapper.Snap(grabbable))
                    {
                        grabbable.gameObject.SetActive(false);
                    }
                    return;
                }

                SetActiveGrabbables(true);
            }
            else if (OVRInput.GetUp(trigger, controller))
            {
                SetActiveGrabbables(false);
            }
        }
 void Update()
 {
     if (OVRInput.Get(OVRInput.NearTouch.SecondaryIndexTrigger))
     {
         DrawLine.enabled = false;
     }
     else
     {
         DrawLine.enabled = true;
     }
     if (OVRInput.GetDown(OVRInput.Button.One))
     {
         RaycastHit Hit;
         Ray        NewRay = new Ray(transform.position, transform.forward);
         if (Physics.Raycast(NewRay, out Hit))
         {
             if (Hit.transform.tag == "Lamp")
             {
                 Hit.transform.gameObject.GetComponent <MeshRenderer>().enabled = !Hit.transform.gameObject.GetComponent <MeshRenderer>().enabled;
             }
         }
     }
 }
 // Update is called once per frame
 //GameObject instantiatedobject = Instantiate(prefab) as GameObject;
 void Update()
 {
     if (newflower != null)
     {
         newflower.GetComponent <Rigidbody>().velocity        = Vector3.zero;
         newflower.GetComponent <Rigidbody>().angularVelocity = Vector3.zero;
         newflower.GetComponent <Rigidbody>().ResetInertiaTensor();
     }
     if (OVRInput.GetDown(OVRInput.Button.SecondaryHandTrigger))
     {
         if (cash == true)
         {
             gettea();
         }
     }
     if (OVRInput.GetDown(OVRInput.Button.SecondaryIndexTrigger))
     {
         if (cash == false)
         {
             droptea();
         }
     }
 }
Example #28
0
 // Update is called once per frame
 void Update()
 {
     if (acceptInput == true)
     {
         if (OVRInput.GetDown(OVRInput.Button.One))
         {
             Debug.Log("Button A");
             BtnADown.Invoke();
         }
         if (OVRInput.GetDown(OVRInput.Button.Two))
         {
             Debug.Log("Button B");
         }
         if (OVRInput.GetDown(OVRInput.Button.Three))
         {
             Debug.Log("Button X");
         }
         if (OVRInput.GetDown(OVRInput.Button.Four))
         {
             Debug.Log("Button Y");
         }
     } //end if acceptInput==true
 }     //end  Update()
Example #29
0
    void Update()
    {
        SelectCamera cg = GetComponent <SelectCamera>();

        if (cg.CamNum == 2)
        {
            Ctrlstatus = true;
        }
        else
        {
            Ctrlstatus = false;
        }

        if (Ctrlstatus == true)
        {
            if (OVRInput.GetDown(OVRInput.Button.Two, OVRInput.Controller.RTouch))
            {
                Debug.Log("exit scene");
                SceneManager.LoadScene("TestScene1");
            }
            tr.Rotate(Vector3.up * Time.deltaTime * rotSpeed * Input.GetAxis("Mouse X"));
        }
    }
    // Update is called once per frame
    void LateUpdate()
    {
        if (OVRInput.GetDown(OVRInput.Button.Two) || Input.GetKeyDown(KeyCode.M))
        {
            hide = !hide;
        }

        menu.SetActive(!hide);

        if (hide == true)
        {
            menupos = campos + maincamera.transform.forward * distance;
            menu.transform.forward = maincamera.transform.forward;

            menu.transform.position = menupos;
        }
        if (hide == false)
        {
            menu.transform.localRotation = Quaternion.Euler(new Vector3(menu.transform.eulerAngles.x,
                                                                        menu.transform.eulerAngles.y, 0f));
        }
        campos = maincamera.transform.position;
    }