# Scene Setup

WARNING

This guide assumes pre-existing knowledge of XR Development in Unreal engine. For a more detailed overview, please visit the introductory documentation page (opens new window).

The Snapdragon Spaces Samples contain ready-to-use blueprints for common AR use cases.

# Core blueprints

These blueprints are prepared to work in an AR environment and are the basis for our project.

The BP_GameMode (located under Content > SnapdragonSpaces > Common > Core) defines the rules of an experience. Currently, it only sets the default pawn class to custom BP_Pawn. To avoid customizing it for each map, go to Project Settings > Maps & Modes and overwrite the Default GameMode.

Configure Maps & Modes in the project settings

In Unreal Engine, a pawn is the physical representation of the user and defines how the user interacts with the world. The custom BP_Pawn (located under Content > SnapdragonSpaces > Common > Core) can be used with a gaze or 3DoF controller for interaction. Furthermore, it also includes an implementation of these interaction controllers for testing them in the editor.

Components in BP_Pawn

The D_ARSessionConfig (located under Content/SnapdragonSpaces/Common/Core) defines what features are used in the AR session. For basic information about this asset, please refer to the Unreal documentation (opens new window). Currently, BP_Pawn defines the session config we are using in our demo.

# Controller blueprints

The implementation for the different controllers is done in components for easy extension or replacement in the actors.

The parent component class BP_ControllerComponent (located under Content > SnapdragonSpaces > Common > Core > Components) holds access to the gaze and pointer controller. This blueprint also establishes the basis for managing the interaction and includes some options that are customizable for the developer in all derived controllers.

  • bAutoActivate: Indicates if the controller is enabled by default.
  • DelayStart: When the app starts or loads a new map, it is the time that should elapse until interaction should be enabled.

# Gaze Controller

The gaze controller BP_GazeControllerComponent (located under Content > SnapdragonSpaces > Common > Core > Components), manages the raycasting and interactions with widget actors in the scene as well as the delay interaction functionality and "click" functionality of the pointer.

Gaze Pointer Limitation

Currently, the gaze pointer can only interact with widget actors in the scene, unlike the Pointer Controller, which can interact with both widgets and 3D actors.

Some options are customizable for the developer as:

  • bMoveReticleHit: If this boolean is enabled and the user looks at an interactive actor, the reticle moves to the interactive position of the actor.
  • TimerDuration: How many seconds the user has to look at something to select it.
  • DefaultDistance: When bMoveReticleToHit is active, this sets the distance at which the gaze controller is drawn.
  • ReticleOuterRing: Material for the outer ring reticle.
  • VerticalBias: The vertical position of the reticle considering 0 the center of the screen, 1 the top of the screen, and -1 the bottom of the screen.

Gaze controller component settings

Finally, the reticle, which the samples use to point to the world, is composed of two planes as a Static Mesh Component: one of them with a static material for the inner ring (MI_Reticle_Inner) and the other uses a dynamic material for the outer ring (MI_Reticle_Outer). This dynamic material defines a parameter (Percentage) to complete the visual effect of the reticle interaction. In addition, the function Update Reticle Position (in the component blueprint) uses the outer texture as the parent of the components related to the reticle, and uses it to move them in the interaction hits. The component distinguish each texture using the Component Tags (gaze, gaze_outerring, gaze_parent).

# UI

The 3D Widgets located in the world must be created using the blueprint BP_3DWidget (located under Content > Snapdragon > Common > UI) and define the UI in the WidgetComponent. To work with the gaze or pointer controller, it must be a child class of this class.