|
Team
Solo
Engine
Unity
Plugin
SteamVR
VR Locomotion with Blinders
The majority of fast-paced action VR games use a locomotion system. Moving with teleportation does not feel as realistic and engaging as continuous movement. However, locomotion has a big disadvantage - motion sickness. Simply speaking, because your eyes detect your body moving, but your brain does not feel it with the cerebellum, you might feel sick. One of the techniques to lower motion sickness is dynamically changing the field of view. In VR this can be done by using blinders (tunneling). I wanted to test this technique, so I have created a prototype of a locomotion system with a blinders effect.
Camera Rig
Steam VR plugin for Unity has a Player prefab which includes a lot of interaction functionality already implemented. However, I didn't need any of that for this prototype, so I went with [CameraRig] prefab. I put it inside the empty Player game object, which will control movement, player's height, and snap rotation.
Character controller and height adjustment
The player needs to have a collider. But instead of using a capsule collider, I went with the Character Controller component. It already contains a collider, but also has a lot of data necessary for locomotion. The collider's height should be adjusted according to the player's movement. If they crouch, they should be able to move underneath high objects. So, I have added a VRController.cs script to the player. Every frame it calls the UpdateHeight() function. The function changes the collider's height to the camera's local Y-axis position and recenters it.
Steam VR Input
Steam VR has a tool for creating actions to bind them with the input system (Window -> SteamVR input). You might need to adjust them based on the type of controllers you use. Actions I needed for this project are JoystickPosition and SnapTurn (left and right). The first one receives a Vector2 from the current joystick's position. The second two receive a boolean which is true when the player moved the stick to the left or right, respectively.
Movement
Movement in VR, using the controller's joystick, can be head-oriented or hand-oriented. What it means is that the player's forward vector can be based either on the current head's rotation or on the current hand's rotation. In fact, this is just a matter of taste. In my case, I went with the head-oriented movement since I find it more intuitive.

During every frame, inside the VRController.cs script, I calculate the player's movement direction by taking their head's rotation and adding the joystick's direction to it. The speed of the movement is calculated based on the magnitude of the joystick's displacement vector. Using the direction and the speed, I can create the position change vector. All that's left is to add Y-axis displacement due to gravity.
Blinders
For the tunneling, I went with the vignette effect from the post-processing stack (v.2). I put a Post-process Layer component into the camera game object and created a PostFX empty object with a Post-process Volume component. Since the volume should affect the player's sight all the time, it should be set to global. By adding the vignette effect to the volume and changing its intensity, we can create the tunneling effect.

The intensity value should be based on the player's speed. So by dividing the current speed by the maximum speed, I am calculating the vignette intensity. This is done in the BlindersVR.cs script. Add linear interpolation to it, and blinders are done!
Snap turn
Sometimes, rotating in your room while playing a VR game can be challenging. Especially, while the majority of VR headsets have a wired connection to the PC. For this reason, I have added a snap rotation to the VRController.cs script, which happens when the player moves the right stick to the left or right. Since snap turn gives motion sickness to some people as well as locomotion, I put vignette intensity to the maximum on its use.
Adjustable public variables
VRController.cs
· Minumum and maximum of the player's height
· Gravity strength
· Maximum movement speed
· Joystick sensitivity
· Snap turn rotation in degrees

BlindersVR.cs
· Linear interpolation rate for the vignette's intensity
· Maximum intensities for different settings
Feel free to use it for your projects!
Virtual Reality
Unity
Unreal
Augmented Reality
C#
C++
Agile
Version Control
AI