The Guardian boundary is designed to display in-application wall and floor markers when users get near play-area borders they defined. When the user gets too close to the edge of a boundary, a translucent mesh grid is displayed as a layer that is superimposed over the game or experience.
The following image shows the Guardian boundary activated. In this example, the user’s hands (which are holding Oculus Touch controllers) protrude through the guardian.
After the user sets up the boundaries, they will show up in a layer over any application whenever the user gets too close.
Note: Users can set the boundaries to Walls and Floor, set them to Floor Only, or disable them entirely.
To set up the boundaries:
When you are finished, click Next. Your boundaries are saved.
During initialization, your application can make an API request to get the outer boundary and play area. The outer boundary is the space that the user defined during configuration. The play area is a rectangular space within the outer boundary. With this information, your application can set up a virtual world with “boundaries” that align with the real world. For example, you can adjust the size of a cockpit based on the user-defined play area.
The following functions return information about the outer boundary and play area:
|Returns the width, height, and depth of the play area or outer boundary in meters.|
|Returns the points that define the play area or outer boundary. For the play area, it returns the four points that define the rectangular area. For the outer boundary, it returns all of the points that define the outer boundary.|
During runtime, your application can request whether the boundaries are visible using
ovr_GetBoundaryVisible. When visible, you can choose how the application will respond. For example, you might choose to pause the application, slow the application, or simply display a message.
The boundary status information is returned in a struct which contains the following:
|Returns whether the boundaries are currently visible.|
|Distance to the closest play area or outer boundary surface.|
|Closest point on the boundary surface.|
|Unit surface normal of the closes boundary surface.|
Additionally, you can set the bounds to be visible to orient the user or explain how you will use the space by setting
ovrTrue. When you are finished, simply pass
Note: You can’t force the boundaries off if they were triggered by user.
The default boundary color is cyan. To change the color, use
To help you get started, we provide a code sample at
Samples/GuardianSystemDemo that shows usage of the following APIs:
Boxes collide with the boundary data using the test API, the boundary visibility and color changes every second, and the simulation slows (and then stops) when the HMD or Touch controllers get too close to the boundary.