Interact with the SteamVR Chaperone System

The SteamVR Chaperone system is used to display the boundaries of the Virtual Reality (VR) interaction area. As a tracked device approaches the boundaries, the SteamVR Runtime automatically provides visual cues notifying the user of this. In the following How To we will take a look at two different ways to display the VR interaction area to the user.

For the Chaperone system to work, you will need to make sure you have set up Room Scale VR using the SteamVR tools. For more information on how to do this, please see the official HTC Vive setup pages.

It is not possible nor advisable to disable the Chaperone system from inside Unreal Engine 4 (UE4). You can, however, adjust how UE4 will react to the user getting close to the boundaries.

Steps

Below you will find instructions on spawning static meshes at the four corners of the VR interaction area as well as drawing a series of lines that are the exact size and shape of the VR interaction.

You can download the Lighthouse Basestation Static Mesh and Texture used in this How To from the following link. Lighthouse Basestation Static Mesh & Texture

  1. First, open up your Player Pawn Blueprint and add a new Static Mesh Component variable called baseStationArray. Since this variable will be used to store the Static Mesh we want to spawn at the four corners of the VR Interaction area when creating the baseStationArray variable, make sure that the Variable Type is set to Array.
  2. Next, add the following nodes with the following values to the Event Graph:
    Click for full image.
    Node Name Value
    Motion Controller (R) Trigger N/A
    SteamVRChaperone N/A
    baseStationArray N/A
    Get Bounds N/A
    ForEachLoop N/A
    Add Static Mesh Component Static Mesh: lh_basestation_vive
    Destroy Component N/A
    Array Add  N/A
    IsValid N/A
  3. Next, we need to set up a way to get information about the SteamVR interaction area that the user sets up. To accomplish this inside your Pawn Blueprint connect the SteamVRChaperone variable output to the input on the Get Bounds node as this will allow us to interact with points that make up the SteamVR Chaperone bounds.
    Click for full image.
  4. Now that we can get the points that make up the VR interaction area, we area are going to set up up a ForEachLoop that will go through each corner point in the SteamVRChaperone and add a Static Mesh when the Motion Controller(R) Trigger is pressed. To accomplish this in your Pawn Blueprint make sure your Event Graph setup matches the following image.
    Copy Node Graph
  5. With the ability to display a Static Mesh at the four corners of the VR interaction area, we will set up some Blueprint logic that will check and see if we have a valid Static Mesh to remove and if we do, remove it. To accomplish this in your Pawn Blueprint make sure your Event Graph setup matches the following image.
    Copy Node Graph
  6. Over in the Variables section create a new Vector variable called, SampleSurface, that will be used to store the surface normals of the VR interaction area.
  7. Next, add the following nodes with the following values to the Event Graph:
    Click for full image.
    Node Name Value
    Motion Controller (R) Trigger N/A
    SteamVRChaperone N/A
    GetBounds N/A
    Float / Float x 2 0,2
    SampleSurface N/A
    MinimumAreaRectangle N/A
    DrawDebugBox N/A
  8. With the needed nodes now added to the Event Graph, next, we need to connect them so that when the Motion Controller(R) Trigger is pressed we can sample the position of the vertices that make up the VR interaction area and then draw a box around them. Setting up the nodes to match the following image will allow you to achieve this in your Blueprint.
    Copy Node Graph

End Result

With everything now hooked up, launch the level using the VR Preview button and put on your HTC Vive HMD, picking up your Motion Controller. Now when you squeeze the trigger on the right-hand Motion Controller the bounds of the SteamVR interaction area will be displayed like in the following video.

UE4 Project Downloads

Below you will find a link to where you can download the UE4 project that was used to create this example.

SteamVR Chaperone Interaction Example Project