Search Unity

left and right movement in Vr

Discussion in 'AR/VR (XR) Discussion' started by yesyesok, Nov 5, 2016.

  1. yesyesok

    yesyesok

    Joined:
    Apr 17, 2016
    Posts:
    13
    Guys i'm new to vr development and i just have one quick question

    Let's say i'm creating a endless game, How do i add left and right motions to my vr game.

    Like when i tilt my vr right, the cracter also moves right.
     
  2. NickAtUnity

    NickAtUnity

    Unity Technologies

    Joined:
    Sep 13, 2016
    Posts:
    84
    You can use InputTracking.GetLocalRotation to get the rotation applied to any tracked node. In your case you can check the Head node and that will tell you the rotation of the head which you can use to determine if the user is tilting their head left or right.

    That said, I'd recommend being careful with this type of control mechanism. For some people, lateral motion can induce motion sickness and the repeated tilting of the neck can cause some muscle strain. What you might try instead of a tilt would be to have the player look forward where they want to go and move the player in that direction. This would be a more normal motion for the head (turning left/right as opposed to tilting) and would keep the player feeling like the motion is always forward which tends to be easier