1

I can't get my Gear VR touchpad to work - I'm just trying to move the camera position on touch. I've tried both pieces of code below:

public Camera cam;
void Update()
{
    if (Input.GetMouseButton (0)) 
    {
        cam.transform.position = new Vector3(-100f, -100f, -100f);
    }
}

and

void Start () 
{
    OVRTouchpad.Create();
    OVRTouchpad.TouchHandler += HandleTouchHandler;         
}

void HandleTouchHandler (object sender, System.EventArgs e)
{
    OVRTouchpad.TouchArgs touchArgs = (OVRTouchpad.TouchArgs)e;
    if(touchArgs.TouchType == OVRTouchpad.TouchEvent.SingleTap)
    {
        cam.transform.position = new Vector3(-100f, -100f, -100f);
    }
}

My script is attached to the OVRPlayerController

Ludovic Feltz
  • 11,416
  • 4
  • 47
  • 63
yya
  • 13
  • 2

1 Answers1

0

You can't move the VR Camera, it's the SDK that determine the Camera position.

In order to move your camera you can just make a new GameObject as a parent of your Cam then move the parent GameObject (here ParentCamera):

public GameObject ParentCamera;

void Update()
{
    if (Input.GetMouseButton (0)) 
    {
        cam.transform.position = new Vector3(-100f, -100f, -100f);
    }
}
Ludovic Feltz
  • 11,416
  • 4
  • 47
  • 63