Guardian System Boundary Component
OculusRiftBoundaryComponent exposes an API for interacting with the Oculus Guardian System.
During Touch setup, users define an interaction area by drawing a perimeter called the Outer Boundary in space with the controller. An axis-aligned bounding box called the Play Area is calculated from this perimeter.
When tracked devices approach the Outer Boundary, the Oculus runtime automatically provides visual cues to the user demarcating the Outer Boundary. This behavior may not be disabled or superseded by applications, though the Guardian System visualization may be disabled via user configuration in the Oculus App.
Additional handling may be implemented by applications using the class UOculusRiftBoundaryComponent. Possible use cases include pausing the game if the user leaves the Play Area, placing geometry in the world based on boundary points to create a “natural” integrated barrier with in-scene objects, disabling UI when the boundary is being rendered to avoid visual discomfort, et cetera.
All UOculusRiftBoundaryComponent public methods are available as Blueprints.
Please see OculusRiftBoundaryComponent.h for additional details.
Boundary types are Boundary_Outer and Boundary_PlayArea.
Device types are HMD, LTouch, RTouch, Touch (i.e., both controllers), and All.
Applications may query the interaction between devices and the Outer Boundary or Play Area by using UOculusRiftBoundaryComponent::GetTriggeredPlayAreaInfo() or UOculusRiftBoundaryComponent::GetTriggeredOuterBoundaryInfo().
Applications may also query arbitrary points relative to the Play Area or Outer Boundary using UOculusRiftBoundaryComponent::CheckIfPointWithinOuterBounds() or UOculusRiftBoundaryComponent::CheckIfPointWithinPlayArea(). This may be useful for determining the location of particular Actors in a scene relative to boundaries so, for example, they are spawned within reach, et cetera.
Results are returned as a struct called FBoundaryTestResult, which includes the following members:
Returns true if the device or point triggers the queried boundary type.
Device type triggering boundary.
Distance between the device or point and the closest point of the test area.
Describes the location in tracking space of the closest boundary point to the queried device or point.
Describes the normal of the closest boundary point to the queried device or point.
All dimensions, points, and vectors are returned in Unreal world coordinate space.
Applications may request that boundaries be displayed or hidden using RequestOuterBoundaryVisible(). Note that the Oculus runtime will override application requests under certain conditions. For example, setting Boundary Area visibility to false will fail if a tracked device is close enough to trigger the boundary’s automatic display. Setting the visibility to true will fail if the user has disabled the visual display of the boundary system.
Applications may query the current state of the boundary system using UOculusRiftBoundaryComponent::IsOuterBoundaryDisplayed() and UOculusRiftBoundaryComponent::IsOuterBoundaryTriggered().
You may bind delegates using the object OnOuterBoundaryTriggered.
You may set the boundary color of the automated Guardian System visualization (alpha is unaffected) using UOculusRiftBoundaryComponent::SetOuterBoundaryColor(). Use UOculusRiftBoundaryComponent::ResetOuterBoundaryColor()to reset to default settings.
UOculusRiftBoundaryComponent::GetOuterBoundaryPoints() and UOculusRiftBoundaryComponent::GetPlayAreaPoints()return an array of up to 256 3D points that define the Boundary Area or Play Area in clockwise order at floor level. You may query the dimensions of a Boundary Area or Play Area using UOculusRiftBoundaryComponent::GetOuterBoundaryDimensions() or
UOculusRiftBoundaryComponent::GetPlayAreaDimensions(), which return a vectors containing the width, height, and depth in tracking space units, with height always returning 0.
BoundarySample, available from our Unreal GitHub repository, illustrates the use of the Boundary Component API for interacting with our Guardian System. For more information, see Unreal Samples.