top of page

Guide: VR Player Locomotion in Unreal Engine 5 with the Head Mounted VR Plugin

Updated: Dec 3, 2024

Introduction 🚀

Virtual Reality (VR) has revolutionized the way we interact with digital environments, offering immersive experiences that were once the stuff of science fiction. Unreal Engine 5 (UE5) stands at the forefront of this revolution, providing developers with powerful tools to create stunning VR applications. A crucial aspect of VR locomotion development in Unreal Engine 5 is implementing smooth and intuitive locomotion mechanics, which can significantly impact user immersion and comfort.

Head Mounted VR Plugin — a superior solution for advanced VR interactions and rapid implementation in Unreal Engine 5. This guide will walk you through setting up the Player Base using the Head Mounted VR plugin, focusing on collision detection, locomotion, and input configuration. Whether you're a beginner or an advanced developer, this comprehensive guide will equip you with the knowledge to enhance your VR projects.


Table of Contents of VR Locomotion Development in Unreal Engine 5📑


VR Player Smooth Locomotion In Unreal Engine 5 with Head Mounted VR
VR Player Smooth Locomotion In Unreal Engine 5 with Head Mounted VR

Prerequisites 📝

Before diving in, ensure you have the following:

  • Unreal Engine 5 installed on your system.

  • The Head Mounted VR Plugin downloaded.

  • Basic understanding of Unreal Engine's interface and navigation.


Adding the Head Mounted VR Plugin to Your Project  🛠️


Step 1: Download the Plugin  📥

  1. Visit the Head Mounted VR on Fab.

  2. Press the download button.


    Head Mounted VR Plugin for Unreal Engine
    Head Mounted VR Plugin for Unreal Engine

Screenshot of Unreal Engine's Plugins window with the Head Mounted VR plugin enabled
Screenshot of Head Mounted VR Plugin from Fab library

Step 2: Install the Plugin into your project(Optional)📁

  1. Copy the downloaded plugin folder into your project's Plugins directory. If the folder doesn't exist, create it.


    Unreal Engine Project Plugins folder
    Unreal Engine Project Plugins folder

Step 3: Enable the Plugin in Unreal Engine ✅

  1. Reopen your project in Unreal Engine 5.

  2. Go to Settings > Plugins in the toolbar.

  3. In the Plugins window, search for Head Mounted VR.

  4. Check the box next to the plugin to enable it.

  5. Restart Unreal Engine when prompted.



Screenshot of Unreal Engine's Plugins window with the Head Mounted VR plugin enabled
Screenshot of Unreal Engine's Plugins window with the Head Mounted VR plugin enabled


Configuring Collision Channels ⚙️

Proper collision detection is vital for realistic VR interactions. The Head Mounted VR plugin requires specific collision channels to function correctly.


Step 1: Open the DefaultEngine.ini File 🗂️

  1. Navigate to your project's directory.

  2. Go to Config/DefaultEngine.ini.


Step 2: Add Collision Channels 🖥️

Add the following lines under the [/Script/Engine.CollisionProfile] section:


+DefaultChannelResponses=(Channel=ECC_GameTraceChannel2, DefaultResponse=ECR_Block, bTraceType=False, bStaticObject=False, Name="GrabbedObject") 
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel3, DefaultResponse=ECR_Block, bTraceType=False, bStaticObject=False, Name="VR_Hands") 
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel4, DefaultResponse=ECR_Block, bTraceType=False, bStaticObject=False, Name="Door_Parent") 
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel5, DefaultResponse=ECR_Block, bTraceType=False, bStaticObject=False, Name="VRWeapon") 
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel6, DefaultResponse=ECR_Block, bTraceType=False, bStaticObject=False, Name="NPC")

Setting Up Physical Surface Types 🌍

Defining physical surface types enhances collision detection and allows for context-specific interactions like footstep sounds.


Step 1: Modify DefaultEngine.ini

In the same DefaultEngine.ini file, add the following under [/Script/Engine.PhysicsSettings]:

+PhysicalSurfaces=(Type=SurfaceType1,Name="Dirt")
+PhysicalSurfaces=(Type=SurfaceType2,Name="Rock")
+PhysicalSurfaces=(Type=SurfaceType3,Name="Sand")
+PhysicalSurfaces=(Type=SurfaceType4,Name="Water")
+PhysicalSurfaces=(Type=SurfaceType5,Name="Glass")
+PhysicalSurfaces=(Type=SurfaceType6,Name="Cloth")
+PhysicalSurfaces=(Type=SurfaceType7,Name="Metal")
+PhysicalSurfaces=(Type=SurfaceType8,Name="wood")
+PhysicalSurfaces=(Type=SurfaceType9,Name="Grass")
+PhysicalSurfaces=(Type=SurfaceType10,Name="Carpet")
+PhysicalSurfaces=(Type=SurfaceType11,Name="Concreate")
+PhysicalSurfaces=(Type=SurfaceType12,Name="Snow")
+PhysicalSurfaces=(Type=SurfaceType13,Name="Tile")
+PhysicalSurfaces=(Type=SurfaceType14,Name="Asphalt")
+PhysicalSurfaces=(Type=SurfaceType15,Name="Brick")
+PhysicalSurfaces=(Type=SurfaceType16,Name="Cardboard")
+PhysicalSurfaces=(Type=SurfaceType17,Name="Clay")
+PhysicalSurfaces=(Type=SurfaceType18,Name="Plastic")
+PhysicalSurfaces=(Type=SurfaceType19,Name="Electrinics")
+PhysicalSurfaces=(Type=SurfaceType20,Name="Sheetrock")
+PhysicalSurfaces=(Type=SurfaceType21,Name="Plaster")
+PhysicalSurfaces=(Type=SurfaceType22,Name="Leaver")
+PhysicalSurfaces=(Type=SurfaceType23,Name="Blood")
# ... Add additional surfaces as needed

Step 2: Save and Restart 💾🔄

  • Save the changes.

  • Restart Unreal Engine to ensure the new surface types are recognized.


Setting Up the VR Player Pawn👤

The VR Player Pawn is the core of your player's presence in the virtual world.


Step 1: Create a VR Player Blueprint 🖌️

  1. In the Content Browser.

  2. Right-click and select Create Blueprint Class Based on AVR_Player.

  3. Name it (e.g., BP_VRPlayer).


Creating VR Player Class in Unreal Engine 5
Creating VR Player Class in Unreal Engine 5

Step 2: Configure the VR Player Pawn⚙️

  1. Open BP_VRPlayer in the Blueprint Editor.

  2. Set as Default Pawn:

    • Go to Edit > Project Settings > Maps & Modes.

    • Under Selected GameMode, set Default Pawn Class to BP_VRPlayer.


VR Player Blueprint In Unreal Engine 5 Editor
VR Player Blueprint In Unreal Engine 5 Editor

VR Player Blueprint In Unreal Engine 5 Editor
VR Player Blueprint In Unreal Engine 5 Editor


Step 3: Selecting the VR Hand Class ✋

Configuring the player's hands is essential for interactive and immersive VR experiences. The Head Mounted VR plugin allows you to customize the hands by selecting a specific hand class.


VR Hands in Unreal Engine 5 Project using Head Mounted VR
VR Hands in Unreal Engine 5 Project using Head Mounted VR

  1. Locate the VR_HandsClass setting 🔍

    • In the Blueprint Editor for BP_VRPlayer, navigate to the Details panel.

    • Find the setting named VR_HandsClass.


  2. Assign a Child Class or Blueprint of AVR_Hands 🔧

    • Create a Custom Hands Class:

      • Right-click in the Content Browser and select Blueprint Class.

      • Choose UVR_HandsComponent as the parent class.


    • Customize the Hands:

      • Check out the VR Hand Customization guide here.


    • Assign the Custom Class:

      • Return to BP_VRPlayer.

      • In the Details panel, set the VR_HandsClass setting to your hands blueprint.


Input Configuration 🎛️

Configuring input is essential for responsive VR interactions.


Step 1: Enable Enhanced Input 🔄

  1. Go to Edit > Plugins.

  2. Ensure Enhanced Input is enabled.


Step 2: Assign Input Mapping Context 📲

  1. Open BP_VRPlayer.

  2. In the Details panel, locate Input settings.

  3. Use the default one Input Mapping Context(provided by the Head Mounted VR plugin) or your custom one.


    VR Player Input Settings
    VR Player Input Settings

Step 3: Customize Input Bindings 🔄

  • To adjust input bindings:

    • Navigate to the Input folder in the Content Browser.

    • Open the Input Mapping Context.

    • Rebind actions to suit your project's needs.


VR Player IMC
VR Player IMC

Locomotion and Movement Mechanics 🕹️

Implementing effective locomotion is crucial for user comfort and immersion. The Head Mounted VR plugin offers multiple locomotion methods and customizable movement settings.


Movement Types 🚶‍♂️

The plugin provides several movement types that can be easily configured:

  • Continuous Movement: Traditional smooth locomotion controlled by thumbsticks.

  • Teleport Blink: Instantaneous teleportation with a blink effect.

  • Teleport Shift: A shift-style teleportation similar to the system used in Half-Life: Alyx.



Unreal Engine 5 VR Continuous Movement
Unreal Engine 5 VR Continuous Movement

Unreal Engine 5 VR Blink Teleport
Unreal Engine 5 VR Blink Teleport


Unreal Engine 5 VR Shift Teleport
Unreal Engine 5 VR Shift Teleport

Configuring Movement Types 🎮

To customize movement types:

  • Open BP_VRPlayer in the Blueprint Editor.

  • In the Details panel, locate the Movement Settings.


Parameters:

  • EMovementType: Choose between Continuous, Teleport Blink, or Teleport Shift.

  • ETurnType: Select Smooth or Quick Turn.

  • EQuick_Turn_Angle: Set the angle for quick turns (adjustable between 15-90 degrees).

  • Movement Source: Define the reference point for movement (HMD, Left Controller, Right Controller, Hip).


Unreal Engine VR Locomotion Parametrs
Unreal Engine VR Locomotion Parameters

Teleportation Settings 🚀

  • Teleport Physics Types:

    • None: Do not teleport physics bodies. Velocity reflects movement between positions, and collisions occur along the way.

    • TeleportPhysics: Teleport physics bodies so that velocity remains the same, and no collision occurs.

    • ResetPhysics: Teleport physics bodies and reset physics state completely.

  • Camera Fade Settings:

    • TeleportFadeOutDuration

    • TeleportFadeInDuration

    • TeleportFadeColor



Unreal Engine 5 VR Teleport Physics
Unreal Engine 5 VR Teleport Physics

Enabling Shift Teleport as Jump 🦘

  • In BP_VRPlayer, set bTeleportAsJump to true to use Shift Teleport as a jump action.


Collision🕹️

Understanding the underlying mechanics enhances your ability to customize and troubleshoot.


Collision Detection 🔍

The plugin uses advanced collision detection to prevent the player from passing through objects and to handle interactions smoothly.


  • VR Player Smooth locomotion in Unreal Engine 5 using Head Mounted VR plugin
    VR Player Smooth locomotion in Unreal Engine 5 using Head Mounted VR plugin

    VR Player Teleport in Unreal Engine 5 using Head Mounted VR plugin
    VR Player Teleport in Unreal Engine 5 using Head Mounted VR plugin

    VR Player Collision Detection in Unreal Engine 5 using Head Mounted VR plugin
    VR Player Collision Detection in Unreal Engine 5 using Head Mounted VR plugin

Customization and Flexibility 🎨

Tailor the plugin to fit various use cases.


VR Payer Shooting in Unreal Engine 5 with Head Mounted VR
VR Player Shooting in Unreal Engine 5 with Head Mounted VR

Use Cases 📚

  • Room-Scale Movement: Optimize settings for players with ample physical space.

  • Seated Experiences: Adjust parameters for players who are seated or have limited movement.

VR Tracking Settings In Unreal Engine 5
VR Tracking Settings In Unreal Engine 5

Troubleshooting Tips🛠️

Input Conflicts ⚠️

  • Issue: Inputs are unresponsive or trigger unintended actions.

  • Solution: Check for conflicting input mappings and ensure the correct Input Mapping Context is active.


Conclusion 🎉

Implementing effective VR locomotion and interactions is crucial for creating immersive experiences. The Head Mounted VR plugin simplifies this process, offering advanced features and rapid implementation. By following this guide, you've set up the Player Base in Unreal Engine 5, configured collision detection, locomotion, and input, and learned how to customize the plugin to suit your project's needs.


Ready to elevate your VR projects? 🚀


Additional Resources 📚

102 views
bottom of page