CoLocationHS sample overview
Updated: May 11, 2026
The CoLocationHS sample demonstrates the older Shared Spatial Anchors approach (user-ID-based, not the Colocation Discovery API). It uses a two-phase architecture (lobby + showcase), BP_CoLocationComponent for anchor lifecycle management, passthrough with poke-a-hole materials, a Blueprint component architecture, device capability checking in C++, and targets UE 5.4.
- Shared Spatial Anchors with user-ID-based sharing
- Two-phase architecture (lobby and showcase)
- Anchor lifecycle management via Blueprint components
- Passthrough with poke-a-hole materials
- Device capability checking in C++
- Avatar representation in co-located experiences
- Meta Quest 2, Quest 3, or Quest 3S
- UE 5.4
- Clone the repository.
- Open the project in UE 5.4.
- Configure app credentials in the Oculus Developer Dashboard.
- Deploy to two or more Quest devices for co-location testing.
- Start with the lobby phase to establish shared anchors.
| File / Scene | What it demonstrates | Key concepts |
|---|
Lobby phase | Anchor creation and sharing | User-ID-based spatial anchor sharing |
Showcase phase | Co-located interaction | Shared world alignment |
BP_CoLocationComponent | Anchor lifecycle | Create, share, localize, destroy |
Passthrough materials | Mixed reality rendering | Poke-a-hole technique |
Device capability check | Hardware validation | C++ capability query |
The app starts in the lobby phase where one user creates a spatial anchor and shares it with other users via their user IDs. Once all participants have localized the shared anchor, the experience transitions to the showcase phase where users interact in a shared coordinate space. Passthrough rendering uses poke-a-hole materials to reveal virtual content through the physical environment. Avatars represent each co-located player.
Shared Spatial Anchors (user-ID-based)
This sample uses the older user-ID-based approach for sharing spatial anchors. One user creates an anchor and explicitly shares it with other users by their Oculus user IDs.
Note: For new projects, consider using the Colocation Discovery API which provides automatic discovery without requiring user IDs.
BP_CoLocationComponent manages the full anchor lifecycle:
- Create — Generate a spatial anchor at the desired position
- Share — Send the anchor to other users by user ID
- Localize — Receiving users localize the shared anchor
- Destroy — Clean up anchors when the session ends
Passthrough uses poke-a-hole materials that render as transparent windows into the physical world, allowing virtual content to appear embedded in the real environment.
A C++ capability check validates hardware support before enabling co-location features:
// Check device supports shared spatial anchors
bool bSupported = `UOculusXRFunctionLibrary`::IsDeviceCapabilitySupported(EDeviceCapability::SharedSpatialAnchors);
- Migrate to the Colocation Discovery API for automatic peer discovery
- Add persistent anchor storage for returning sessions
- Implement custom avatar representations
- Add shared interactive objects in the showcase phase