text
stringlengths
0
1.11k
Prerequisites
The basic prerequisites for the SSA feature are the same as those of the Spatial Anchors feature. In addition,
Your application must be registered on your developer dashboard, and it must support both passthrough and SSA. See the Shared Spatial Anchor section Set up Project Environment for specifics.
Set up your chosen network solution in a way that facilitates multiplayer collaboration. More on this in the next section.
There are also requirements for specific Quest headsets tied to the SDK version used:
Meta Quest Pro supports Shared Spatial Anchors starting in v47.
Quest 2 supports Shared Spatial Anchors starting in v49.
Quest 1 does not support sharing spatial anchors.
The device setting ‘Share Point Cloud Data’ must be enabled. It can be found under Settings > Privacy > Device Permissions > Turn on “Share Point Cloud Data”. More on this below.
If you can build the Spatial Anchors Sample, you can build apps using SSA. We recommend that you do the Spatial Anchors Basic Tutorial and walkthrough Shared Spatial Anchors sample for hands-on experience using spatial anchors before working with shared spatial anchors.
App Configuration
We verify the identity of the application requesting access to persisted Spatial Anchors. Because this verification uses information registered in the Store, your application will not be able to persist or share Spatial Anchors until you register your app on Oculus Developer Dashboard.
To enable Spatial Anchor persistence and sharing in your app, you will need to:
Have a verified Meta developer account. If you haven’t yet, sign-up here.
Create or join an organization you will develop your app under. For more information, see Manage Your Organization and Users.
Create an App ID.
Enable “User ID” and “User Profile” in Data Use Checkup.
When creating your app choose either “Meta Quest (Store)” or “Meta Quest (App Lab)” depending how you wish to eventually deploy it. If you will use Meta Quest Link to run the app from your PC, repeat these steps to also create a Rift app.
You must complete a Data Use Checkup on each of your apps. To enable spatial anchor persistence:
Obtain admin access to your App if you don’t have it already.
Go to the developer dashboard and select your App.
Next, click Data Use Checkup in the left navigation pane.
Add User ID and User Profile Platform Features then submit the request.
More Information about how to create your application can be found on the Creating and Managing Apps page.
Create Test Users
The features requested above will not be available to users of your app until the Data Use Checkup review process is complete. In order to proceed with development, you will want to create a Test User which is exempt from DUC requirements. You will also need to assign these test users to the Developer role in your app’s org. See How to develop apps while waiting for DUC approvals for more details.
Android Manifest
The Oculus manifest tool can be used to update your project manifest to support SSA:
Oculus > Tools > Create store-compatible AndroidManifest.xml.
For SSA and passthrough to work, the following permissions are required:
<uses-permission android:name=”com.oculus.permission.USE_ANCHOR_API” />
<uses-permission android:name=”com.oculus.permission.IMPORT_EXPORT_IOT_MAP_DATA” android:required=”false” />
<uses-feature android:name=”com.oculus.feature.PASSTHROUGH” android:required=”true” />
The Oculus manifest tool will add these permissions when used with the above OVRManager configuration.
Set Up App Release Channel
Adding Users
In order to obtain entitlements for the user accounts used during development (including test users), you should add them to one of the release channels associated with your app. Release Channels are configured in the Distribution section of the app configuration.
Uploading A Build
Finally, you should upload an APK for your test app to the same release channel you added your development users to. Make certain that the APK is built using the App ID that matches the one defined in the app configutation. This ensures that the entitlement checks are successful.
The Big Picture
The sharing of spatial anchors among players implies a multiplayer environment. For this description, refer to Photon Unity Networking, because our Shared Spatial Anchors Showcase App uses Photon.
From a high level, the process for integrating SSAs into your application successfully is as follows:
Connect users with each other: Create a room using the network solution. Get users to join the same room, either by membership, activity board, or invitation. For example, Photon’s matchmaking and lobby functions can help you accomplish this.
Create an SSA by instantiating an object that has the OVRSpatialAnchor component on it.
Save the SSA to Cloud using OVRSpatialAnchor.Save(), with the storage location Cloud. Wait for this call to complete before Sharing the SSA. You may also optionally save the spatial anchor to Local to keep it locally for longer use.
Share the SSA using OVRSpatialAnchor.Share() to all players of the room. Wait for this call to complete. Other players can now load the SSA.
Distribute the SSA UUID: For instance, broadcast the SSA’s UUID to all players in the room using the network solution.
Load the SSA: For each player, capture the broadcasted UUID from the step above, and use it to load the SSA from storage location Cloud using OVRSpatialAnchor.LoadUnboundAnchors().
Done: All players can now use the SSA as a shared coordinate frame, or origin, and use the content posed by the SSA.
How Do SSAs Work?
As you can see from the previous section, when you share a spatial anchor, you share its UUID, and extend that UUIDs permissions to include more people. If you have used regular spatial anchors, this will not be a new concept to you, because for a regular spatial anchor, you also need to capture its UUID if you want to refer to it in a later session.
In the sample and tutorial referenced in the Prerequisites section, we make use of the Unity PlayerPrefs object to save the UUID for a single person - that’s the scope of PlayerPrefs.
For SSA, you still share the UUID, but you do it using a network solution that is accessible to more than one person. In this SSA documentation, we use Photon Unity Networking as our common network sharing option, but you could use any product that has a similar multiplayer facility.
The important thing to remember is that no matter which network solution you use, all the users to whom you plan to share a spatial anchor must have appropriate permissions in your app, so that they can access the spatial anchors you want to share to them.
Saving an SSA
In order to share a Spatial Anchor, the first step is to save it to storage location Cloud. Once SSAs have been saved, they are available for download by the intended users for 24 hours. After 24 hours, the opportunity for the user to download the SSA expires.
Once downloaded, the SSA remains in local storage (as a regular spatial anchor). A downloaded SSA cannot be shared back into the cloud as the same SSA. However, your app can save the spatial anchor as a new spatial anchor, using the storage location Cloud, and then share that new spatial anchor as an SSA.
Sharing an SSA
The OVRSpatialAnchor.Share() method provides you with the ability to share SSAs with a list of participants, each represented by an OVRSpaceUser. Once the Share() function returns successfully, the SSA is ready for access by the participants. It is the responsibility of your application to communicate the UUID of the SSA to be used to the participants such that they can query it.
Destroying Shared Spatial Anchors
After an SSA is shared to a user, it is downloaded to local storage, where to the user it behaves like any other spatial anchor. If you destroy the user’s local spatial anchor, the cloud SSA is not destroyed. Destroying the local spatial anchor also does not change the user’s sharing permission. The SSA is shared to that person until your app removes the permission or until the sharing expires (24 hours).
Ensuring Share Point Cloud Data is enabled