Developing for the Meta Quest 3 with Unreal Engine 5


Introduction

The Meta Quest is a head-mounted standalone system, which is a gateway to experiencing virtual reality (VR). It’s now entering into its third generation, known as Meta Quest 3. It can be developed with game engines — such as Unity and Unreal Engine — that provide you with ready tools for stereo displays and motion tracking.

This tutorial begins your development for the Meta Quest 3 in Unreal Engine 5 (UE5).

VR platforms are primarily supported in UE5 via the OpenXR API plugin. Alternatively, the Meta Quest XR Plugin provides another all-in-one plugin for development on Meta Quest and Oculus Rift headsets, supported by Meta. (This tutorial relies on the OpenXR plugin, as this is the more generalized system.)

Unreal Engine 5 provides a Virtual Reality sample project template which features tools like a VRPawn Blueprint, implementing avatars for motion controllers, player movement, and stereo rendering that follows the orientation of the player’s view.

It’s time to dive into the dungeon in the Meta Quest! Within this tutorial, you’ll explore the basics of the VRPawn Blueprint, and extend the design for customized interactions. You will also see how you can make interactive elements — including grabbable objects, doors, and switches.

Virtual Reality Template

Unreal Engine 4 and 5 both include a variety of usable template projects to help you get a leg up on development for a particular game style.

vr template

The Blueprint Virtual Reality Template provides assets for creating games with teleport locomotion, snap turning, and grabbable objects. The starting sample project builds upon this template project to give an example for how to adapt content to start a VR game.

Download the starter project to begin this tutorial — you can find a link at the top or bottom of this page!

VR Player Character

It’s time to review Game Mode setup. The Game Mode lets you select the VRPawn Blueprint for the initial state of the game, and provides the basics for a VR experience.

Open the starter project in Unreal Engine 5. Then, find the World Settings tab in the lower right of your editor view. Use the Window ▸ World Settings menu option if it’s not already open.

world settings

In Unreal Engine, a Game Mode can be assigned to a level, defining the basic rules of gameplay. The Game Mode can also set the Default Pawn Class, and the initial setup for a level — it sets the VRPawn Blueprint Class to represent the player for the interfaces with the Meta Quest headset and motion controllers.

Next, open the Content Drawer at the bottom of the Unreal Engine editor, and find the VRPawn Blueprint Class by using the ‘Search All’ field. After you find the VRPawn, double-click to open this in the editor.

vrpawn

The VRPawn Blueprint will open in the Blueprint Editor.

To understand this Blueprint, it’s best to break it down into separate parts:

First, notice that the Components tree contains both a Camera that tracks the head-mounted device (HMD), as well as the MotionControllerLeftGrip and MotionControllerRightGrip that provide visual representations of the VR controllers. Underneath those, respectively, are the HandLeft and HandRight skeletal meshes that respond to changes in the controller positions and grip actions.

vrpawn_components

Next, the Event Graph and Functions provide the logic for how inputs from controller presses can grab objects, or lead to movement actions — including teleportation and snap turn movements. Teleportation is a common movement scheme supported in many VR games to mitigate detrimental effects of motion in VR that can lead to nausea.

vrpawn_eventgraph_teleport

In the VRPawn Blueprint, a button press initiates a trace from the current World Location and the Forward Vector of the right controller, and draws a trajectory path to the potential new player location.

On the button release, the Try Teleport block will test if it’s a valid destination, and move the player if so.

First Steps: Teleportation

So, what is a valid destination? It’s any surface on the world map that falls within a NavMeshBoundsVolume, defined as a navigable surface.

The PlayerStart location is positioned at the entrance of the dungeon. You should begin by adding a navigable surface starting there. You’ll need to find a C++ Class from the Engine. To make these visible in the Content Browser, find the settings in the right-hand corner of the browser. Make sure that both Show C++ Classes and Show Engine Content are enabled.

content_settings

Search for the NavMeshBoundsVolume C++ Class from the Content Drawer, and drag a copy of this class into the world view to add to the level.

Select the NavMeshBoundsVolume and look under the Details tab under Transform to change its location as X:955, Y:230, Z:-110, with a Rotation of Z:-45 and a Scale set as X:5.0, Y:10.0, and Z:0.4. This orientation and scale extends the slab of the NavMeshBoundsVolume to completely cover the grass surface of the starting location.

navmesh

Now, in the outliner, copy and paste this NavMeshBoundsVolume to create another copy. Likewise, update the Transform to change its location as X:750, Y:425, Z:-100, with a Rotation of Z:-45 and a Scale set as X:3.0, Y:3.0, and Z:1.0 to cover the staircase.

Create one more copy and paste to add a third NavMeshBoundsVolume, then update its Transform to change its location as X:480, Y:2000, Z:4.5, with a Rotation of Z:0 and a Scale set as X:10, Y:20.0, and Z:0.8 to cover the remaining floors of the rooms above.

Select the three NavMeshBoundsVolumes and zoom out from the map to see a view showing that the floors and stairs are now contained within the overall volumes, and are now traversable.

navmeshboundsvolumes_ingame

It’s time to give VR a test from within the editor! Connect your Meta Quest by a tether to your PC, and make sure that you’ve enabled the tethered connections.

At this point, you’ll be able to teleport across all the rooms of the dungeon. The Teleportation action is initiated by moving the thumbstick forward on the right motion controller.

Enable the VR Preview mode by choosing the menu option in the toolbar.

enable_vrpreview

Click the green arrow button to Play this level in VR and teleport through the dungeon!

teleport_movie

Note: VR Preview is not available on MacOS. However, you can still build quickly to a Meta Quest by choosing Platforms and either selecting Quick Launch if your device is showing on the list, or packaging the project for Android and then installing to your device with ADB or SideQuest. Skip to the end of the tutorial for instructions on how to get set up for building to your Meta Quest device.

Recent Articles

Related Stories

Leave A Reply

Please enter your comment!
Please enter your name here