Search code examples
unity-game-enginegoogle-cardboardvirtual-realitygoogle-vr

Can we program the GVR to move from the mouse input.. Without holding the alt key


I am developing a VR game in unity.. here im planning to get the movement through an external controller.. Im able to program the controller for movement based on the mouse inputs.. But the GVR turn inputs are not accssible.. please help me.


Solution

  • I'm using Cardboard SDK 0.7, it has a script called UnityEditorDevice.cs which has code for the ALT key, so i'd modify that (or maybe you can override it elsewhere)

    if (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) {
    mouseX += Input.GetAxis("Mouse X") * 5;
    if (mouseX <= -180) {
      mouseX += 360;
    } else if (mouseX > 180) {
      mouseX -= 360;
    }