Oculus Go Development

On 6/23/20 Oculus announced plans to sunset Oculus Go. Information about dates and alternatives can be found in the Oculus Go introduction.

Oculus Quest Development

All Oculus Quest developers MUST PASS the concept review prior to gaining publishing access to the Quest Store and additional resources. Submit a concept document for review as early in your Quest application development cycle as possible. For additional information and context, please see Submitting Your App to the Oculus Quest Store.

Boundary Sample for Unreal Engine

This sample app:

  • Demonstrates how to use Blueprints to access the Oculus Guardian System
  • Demonstrates how to position, scale, and rotate objects with respect to the Play Area
  • Demonstrates how to determine when the Guardian boundary is crossed by the headset or either controller

This sample app only works with 6DOF (six degrees of freedom) headsets.

Outer Boundary and Play Area

This sample app renders both the Outer Boundary and the Play Area. The Outer Boundary is the complex set of points and interconnecting lines that the user draws when they setup their boundaries. The Play Area is an automatically generated rectangle within the Outer Boundary:

Sample App Behavior

This sample renders the left and right controllers as black checkered spheres. It also displays a cylinder. The cylinder disappears whenever the headset or either of the controllers cross the guardian boundary.

Drawing Boundaries and Positioning Objects

The body of the Blueprint contains two For loops that draw the Play Area and Outer Boundary.

The first For loop steps through the Outer Boundary points by calling Get Guardian Points with the Boundary Type set to Outer Boundary. It draws each point on the floor as Debug Point’s, and then draws lines between the Debug Point’s.

The following image shows part of the unit cube (white) that has been transformed to conform to the Play Area. The black area is the shadow of the cube. You can see part of the outline of the Outer Boundary, along the floor. In the headset, the white cube is translucent, and you can see where the Outer Boundary continues along the floor. In the headset, you can also see the vertical lines that make up the Guardian representation, whenever the headset or either of the controllers violate the boundary.

The portion of the Blueprint that draws the Outer Boundary is shown below:

This code calls GetGuardianPoints that returns an array that contains all the positions of the Guardian points. The Guardian has no top; it is an infinitely high vertical boundary. So, this For loop draws the Guardian points on the floor and connects them with lines. The Draw Debug Line node takes the current point and the next point (with an index that is incremented by 1), and draws the line segment between them.

Press the trigger on the right controller to redraw the outer boundary. Alternatively, for a PC-connected headset, press ‘Q’ on the keyboard.

The subsequent For loop works in a similar manner, except it retrieves the Play Area points, instead of the Outer Boundary points:

Display and Hide the Cylinder

An Event Tick is fired on every frame:

On each frame, we check to see if the Guardian is visible. The Guardian will be displayed whenever the headset or one of the controllers is violating the boundary. If the Guardian is displayed, we hide the Cylinder. Otherwise, we show the Cylinder:

Set the Transform for Objects in the Play Area**

On each frame we get the Play Area transform, and position a unit cube to align with the Play Area:

By using the above approach, SetWorldTransform enables you to easily scale, rotate, and position objects with respect to the Play Area. The Play Area is a rectangle, so it has three properties: Scale (width and length), Position (the center position), Rotation. It is possible to transform a unit cube - or any other object that you wish - to conform with the Play Area transform by using the technique shown above.

You can use this approach for a wide variety of purposes within your app. For example, if you want to know where the center of the Play Area is, just use the position property of the Transform. If you want to know the rotation value for the Play Area, use the rotation property of the Transform. And, if you want to know the size of the Play Area, read the scale property of the Transform.

If you want to map the floor of your game/app to the Play Area, take the floor and give it a 1m x 1m size. Then you scale/position/rotate it according to the Transform properties.

In this sample, a transform of a 1m x 1m unit cube is placed at the floor of the Play Area. So, if you look down, you will see the cube (as shown earlier in this section). The scale value for the height of the unit cube is 1, which makes it 1m in height. It rises 50 cm above the floor because it is centered vertically with half of the cube above the floor, and half below.

For example, to place something, such as a sword, 1m from the center of the Play Area, you would:

  • Call Get Play Area Transform, retrieve the center of the Play Area from the Position property of the transform.
  • Add 1m in the desired direction.
  • Call SetWorldPosition. This works regardless of the position of the Play Area within the UE4 world.

Suppose you don’t want to position the sword an absolute meter from the center of the Play Area, but rather to a location that is relative to the size of the Play Area. For example, you may have a 20 m Play Area in the X direction, and you want to position the sword half of that distance (in this case 10 m) in the X direction. You would position the sword at 0.5 x the scale of the Play Area in the X direction. You obtain this from the Transform.

Note that the Outer Boundary doesn’t have a Transform, because it has a significantly more complex shape which does not have an obvious scale, position, and rotation. Since the Outer Boundary is too complex for normal game development, the Play Area was created to simplify app development.