Configuring the VRSimulator > Managing Your Play Area |
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:
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:
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. |
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! | |||||||
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:
|
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).
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... | |
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:
In the current Oculus APIs, that data will only be used if:
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 | |
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. |
The PlayAreaManager settings let you adjust several facets of your simulated Play Area's appearance:
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:
|
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:
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... |
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... |
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 | |
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. |