Locomotion, Freedom in VR
Thanks to the XR INTERACTION TOOLKIT we get a few components that we can add to the XR ORIGIN game object to define how the player can move.
In fact, the locomotion system that is included is very dynamic in the fact that we have a few options we can choose from, but the first component that is needed is the LOCOMOTION SYSTEM, which is the base class needed for the various locomotion implementations the toolkit provides. The Locomotion System just needs to reference the XR Origin component.
TRAVERASAL OPTIONS
TELEPORTATION
A type of locomotion that teleports the user from one position to another
CONTINUOUS MOVEMENT
A type of locomotion that smoothly moves the user by an amount over time
The Continuous Move Provider has several variables for us to adjust to get a desired effect, it also needs to reference the Locomotion System Component and reference what forward source we want.
FORWARD SOURCE → is the source gameObject that influences forward movement based on the sources forward direction. There are two common gameObjects to be used as the source…
1. The controller used for movement (the player will always move in the direction the controller is pointed)
2. The Main Camera (Forward is always in the direction the player’s head is facing
With the Left Controller being the desired device to control movement, we need to map the Left Hand Move Action to the appropriate action within the provided Input Action Map.
Now that everything is set up, the project now has movement controls implemented for the player!
TURNING OPTIONS
SNAP TURN
A type of locomotion that rotates the user by a fixed angle
The Snap Turn Provider needs to reference the Locomotion System and also provides some variables that can be adjusted to get the desired effect, including…
- Turn Amount — The number of degrees clockwise to rotate
- Debounce Time — The amount of time that the system will wait before starting another snap turn
Since we have the Left Controller dedicated to Movement, we need to make the Right Controller dedicated to rotation. Although one controller could be used for both movement and rotation, it acts buggy as you are rotating as you are trying to move.
CONTINUOUS TURN
A type of locomotion that smoothly rotates the user by an amount over time
***WARNING: USERS ARE MORE SUSCEPTIBLE TO MOTION SICKNESS WITH CONTINUOUS TURNNING