The GIF is heavily compressed, which is what causes the grainy look.

Locomotion in VR

Jared Amlin
Nerd For Tech

--

Users have a variety of ways they can move and look around in VR. Let’s setup Locomotion and take a look at a few of the options available while weighing the pros vs cons.

Locomotion System

Add a Locomotion System component to your XR Origin and then assign the XR Origin to the appropriate slot. The Locomotion System will handle moving and rotating the player in the VR realm.

If you want to learn in-depth about the Locomotion System, or any other Unity component, just click the question mark to open the Unity documentation on this component.

Here is a direct link if you prefer to read more.

Turn Providers

The Continuous Turn Provider enables a smooth look rotation as you would expect from any 1st person shooter. The main issue many people have when using this in VR, is nausea. If you absolutely need smooth rotations, this turn provider is here for you, although I would recommend dialing back the Turn Speed to reduce the chance of projectile vomiting.

Both Turn Providers need to have the Locomotion System assigned in the System slot.

The Snap Turn Provider is popular in VR simply because it doesn’t induce nausea like the continuous provider does. The Turn Amount value can be used to dictate how many degrees your player will turn when looking right or left. Much like it’s namesake, rather than showing a smooth and dizzying rotation in VR, it will snap your camera to the new look direction.

For a quick and easy setup of the Snap Turn Providers, Unity has provided presets in the starter assets pack.

If you open up the referenced scriptable object, it will open up the Input Actions and highlight the Action Map and Action being used for this turn provider.

The drop-down arrow shows that the Oculus left-stick will turn the player.

Primary 2D Axis is different per device, so you can check the documentation below to see what inputs correspond to a range of devices. This is particularly important if you are doing cross-platform development.

I want the player to turn with their right hand and move with their left hand, not both at simultaneously, so I now disable the Use Reference portion of the Left Hand Snap Turn Action on the Snap Turn Provider.

Continuous Move Provider

The Continuous Move Provider also need the Locomotion System to be assigned into the System slot. There are some handy options you can use such as enabling Strafe, Fly and Gravity.

The Forward Source is the Transform that will drive the movement direction. I assigned the Main Camera so the player will always move in the direction they are looking. You can optionally assign a right or left hand controller, and the player will move in the direction that they are pointing.

I once again set this up using Unity’s preset and then disabled the Right Hand Action Move, being the right hand is only handling rotation.

Here is the player rotating and moving around the scene.

I hope you enjoyed this dive into locomotion in VR. Please join me for my next article where I handle running the player into world objects. Thanks for reading!

--

--

Nerd For Tech
Nerd For Tech

Published in Nerd For Tech

NFT is an Educational Media House. Our mission is to bring the invaluable knowledge and experiences of experts from all over the world to the novice. To know more about us, visit https://www.nerdfortech.org/.

Jared Amlin
Jared Amlin

Written by Jared Amlin

I am an artist and musician, that is currently diving headfirst into game development with C# and Unity3D.

No responses yet