Immerseum SDK: VR Simulator (version: RC-1.0.0)
      [view as: Desktop | Tablet | Mobile]
Managing Your Play Area
In This Topic

Regardless of which HMD your users are using, how they experience your scene will be heavily shaped by the space they're playing in. Both the HTC Vive and the Oculus Rift now support the concepts of a Play Area that defines the real-world space where:

To help with your VR environment design and play testing, the VRSimulator now simulates a Play Area along with an HMD and controllers. Using the Play Area Configuration settings, you can:

Controlling Your Play Area's Behavior

Your simulated play area's behavior is primarily controlled by two PlayAreaManager settings:

Depending on the Display option you select, you may have other configuration choices that need to be configured:

Display: On Approach
When this option is selected, the Play Area will display when your Camera Rig or one of your controllers gets "too close" to the play area's inner boundary. This distance is configurable within the PlayAreaManager's settings, and is calculated along the x-axis and z-axis in worldspace (i.e. ignoring differences in height).
Display: On Input Action
When this option is selected, the Play Area's display will be toggled by user input. The specific InputAction that toggles the simulated Play Area is configured by entering its name in the PlayAreaManager's settings.
Display: Always
When this option is selected, the simulated Play Area will always be displayed.
Display: Never
When this option is selected, the simulated Play Area will never be displayed. It also disables other PlayAreaManager settings.
Be Aware Be Aware
This affects the simulated play area only - it has no impact on either the SteamVR Chaperone boundaries, any SteamVR_PlayArea attached to your camera rig, or the Oculus Guardian boundaries.

Constraining User Movement

The Input Moves setting determines what gets moved in response to the user's input. The two options are:

If you select Input Moves: Camera Only, then your user will only ever be able to move to the interior edge of the simulated play area. As soon as either of the simulated controllers or the camera rig get too close to the simulated play area's inner boundary, the user's movement is stopped.

Be Careful! Be Careful!

If you move or teleport your user outside of the simulated Play Area, you must use scripting to reposition the simulated Play Area around the user. This can be done as in the code snippet below:

Recentering the Play Area
Copy Code
PlayAreaManager.playArea.recenterOnAvatar();

If you select Input Moves: Camera and Play Area, then the simulated play area's gameobject will be attached to your camera rig and whenever your user moves, the simulated play area will move with them (whether it is visible or not).

Controlling Your Play Area's Size

Your simulated Play Area's dimensions are configured in the PlayAreaManager's settings. These dimensions are always expressed in terms of width (measured along the x-axis) and depth (measured along the z-axis).

You can either set the dimensions explicitly (in which case the simulated Play Area will always apply those dimensions), or you can use Calibrated dimensions from your HMD's Chaperone or Guardian calibration data.

You Should Know... You Should Know...

If you set Width/Depth: Calibrated, the VRSimulator will attempt to utilize your HMD's Chaperone or Guardian calibration data to create and scale a simulated Play Area.

In the current SteamVR APIs, that data will only be used if:

  • an HMD is actively-connected, and;
  • that HMD has been calibrated, and;
  • the [CameraRig] prefab has its size set to "Calibrated".

In the current Oculus APIs, that data will only be used if:

  • an HMD is actively-connected, and;
  • that HMD has been calibrated.

If these conditions are not met, then the VRSimulator's simulated play area will fall back to default rectangular dimensions of 3m x 2.25m as measured in Unity worldspace units (meters).

Be Aware Be Aware

If you set your Width/Depth to an explicit set of values, please remember that this will NOT affect your HMD's Chaperone or Guardian calibration data.

Instead, it will simply simulate a play area of a different size, with your HMD's calibration still applying. Thus, if you simulate a larger play area than the one you have configured you will reach the bounds of your HMD's play area (and the Chaperone/Guardian systems will display their warnings) before you reach the bounds of the simulated play area.

Controlling Your Play Area's Appearance

The PlayAreaManager settings let you adjust several facets of your simulated Play Area's appearance:

You Should Know... You Should Know...

The VRSimulator's simulated play area is loosely coupled to your HMD's calibrated Play Area. This means that it ignores any appearance settings you may have configured in your camera rig or in either the SteamVR / Oculus APIs.

If you would like to use your API-supplied representations of your user's play area in addition to the VRSimulator's simulated play area, you can make their appearance / format match as closely as possible using one of the three commands below:

Styling Play Areas
Copy Code
// Applies the simulated Play Area's appearance to a Steam Play Area.
PlayAreaManager.playArea.applySettingsToSteamPlayArea();

// Applies the simulated Play Area's color to an Oculus Play Area.
PlayAreaManager.playArea.applyColorToOculusPlayArea();

// Applies the Steam Play Area's appearance settings to the simulated Play Area.
PlayAreaManager.playArea.applySteamPlayAreaSettings();

Working with Your Simulated Play Area

When your simulated play area is fully initialized (OnInitializePlayAreaEnd), you can access it in your scripts by calling PlayAreaManager.playArea. This exposes the properties of your simulated play area, as well as a variety of methods that can be used to manipulate it. This lets you do several important things:

Evaluate Positions

The PlayArea class exposes a variety of methods and properties that evaluate things in relation to the play area's inner boundary. The important properties and methods are:

// Calculate the shortest distance of either the user's camera rig,
// left-hand controller, or right-hand controller to the Play Area's
// inner boundary.
float distance = PlayAreaManager.playArea.getDistance();

// Calculate the shortest distance given three points in worldspace to
// the Play Area's inner boundary.
Vector3 cameraPosition = new Vector3(0.5f, 0.5f, 0.5f);
Vector3 leftControllerPosition = new Vector3(-1, 0, 0);
Vector3 rightControllerPosition = new Vector3(1, 0, 0);
float distance = PlayAreaManager.playArea.getDistance(cameraPosition, leftControllerPosition, rightControllerPosition);

// Calculate the shortest distance from a point in worldspace to the
// Play Area's inner boundary.
Vector3 point = new Vector3(0.5f, 0.5f, 0.5f);
float distance = PlayAreaManager.playArea.getDistance(point);
// Returns true if the user's camera rig, left-hand controller,
// and right-hand controller are all within the Play Area's
// inner boundary.
bool checkValue = PlayAreaManager.playArea.isWithinBoundary();

// Returns true if all three of the points in world space are
// within the Play Area's inner boundary.
Vector3 cameraPosition = new Vector3(0.5f, 0.5f, 0.5f);
Vector3 leftControllerPosition = new Vector3(-1, 0, 0);
Vector3 rightControllerPosition = new Vector3(1, 0, 0);
bool checkValue = PlayAreaManager.playArea.isWithinBoundary(cameraPosition, leftController, rightController);

// Returns true if the point in worldspace is within the
// Play Area's inner boundary.
Vector3 point = new Vector3(0.5f, 0.5f, 0.5f);
bool checkValue = PlayAreaManager.playArea.isWithinBoundary(point);
For More Information...

Moving Your Play Area

If you need to move your simulated Play Area, you can do so using two different methods:

// Recenters the simulated Play Area on the camera rig's position
// in worldspace.
PlayAreaManager.playArea.recenterOnAvatar();
// Moves the simulated Play Area to a given point in worldspace.
Vector3 point = new Vector3(1, 1, 1);
PlayAreaManager.playArea.move(point);
For More Information...

Changing Your Play Area's Appearance

There are a variety of methods exposed by the PlayArea class that allow you to change the simulated Play Area's appearance which the Scripting Reference: PlayArea Class describes in detail. These methods are:

Best Practice Best Practice

While setPlayAreaSize() and setDimensions() will both adjust the Play Area's size, it is recommended that you adjust dimensions by calling setPlayAreaSize().

Calling setPlayAreaSize() will result in a call to setDimensions() after the play area's size property has been set. However, calling setDimensions() directly will not update the play area's size property.

See Also

Reference

 

 


2017 Copyright © Immerseum Inc. All rights reserved.

Send Feedback