- Home /
How can i move the player with cardboard orientation?
I have setup the google vr sdk in my unity project and it works perfectly with moving the camera. But how can i using the vr orientation to control the player? for example, when i turn my head to left or right, the player move to left or right.
In my code, i just know get input from keyboard:
float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
Vector3 movement = new Vector3(moveHorizontal, moveVertical + motion_cont.getVertical(), 1f);
rb.velocity = movement * motion_cont.getSpeed();
Comment