Shared Spatial Anchors Health and Safety Sample App for Unreal
Health & Safety Recommendation: While building mixed reality experiences with the Passthrough API, we highly recommend that developers evaluate their content to support a comfortable and safe experience for users. Refer to the Mixed Reality Design Guidelines topic for more information.
Co-location increases the number of individuals in a shared physical space with restricted visibility of their surroundings. Crowded experiences create safety risks. It is important to be mindful of the occupancy of the playspace for the shared experience being built. Refer to the Shared Spatial Anchors health and safety guidelines for more guidance.
The colocation sample is available as part of the Oculus Unreal Integration. After cloning the repository, locate the sample app in the Samples/Oculus/CoLocationHS folder. You can also browse the project files on GitHub at Samples/Oculus/CoLocationHS
This document describes the Health and Safety UE4 sample (H&S) for co-located experiences for Meta Quest 2 and Meta Quest Pro devices. As with all features—experimental or otherwise—developers should take care to evaluate their apps’ design and content to support a comfortable and safe experience for users. Please refer to the design best practices available in the Developer Hub (see the Design section) and the Health & Safety Information applicable to the VR system that your app is designed for.
The Health and Safety sample app is created to provide developers with the ability to easily implement warning features.
The offered components reduce the risk during co-located experiences
Prerequisites
Every player needs to log in to their Meta account on their headset.
Project structure
This is a multiplayer experience which contains two levels:
A lobby level
A showcase level
All positions of the virtual avatars and cubes are replicated over the network. When co-located correctly, the avatar will have the same position as the real player. The project depends on the OnlineSubsystemOculus and on the OnlineSubsystemNULL (for creating a local area network session).
Refer to the BP_SessionManager component for more information on the network setup. The network is done with Unreal Engine modules only, there is no need for additional modules.
Input in the experience
Use your controllers, the right joystick to navigate in the UI, right trigger to select and execute the UI item.
Lobby and Showcase world settings
Both levels are set up with their corresponding default classes in the word settings:
Pawns (Lobby and VRPawn)
Player Controllers
Game states
Player states
Gamemodes
The classes are located in CoLocationHS/Blueprints/ and CoLocationHS/GameModes. The lobby provides functionality to create or join a session and the showcase shows the different health and safety modes and a multiplayer cube-gimmick.
Creating and joining a session
Creating a session is straightforward; the player creating it will become the host. All joining players can CoLocate themselves over the menu after joining sucessfully. This provides the following:
Automatic Anchor creating, sharing, aligning
See BP_CoLocationComponent for the implementation details
The color of the selected UI entry will feedback a successful CoLocation.
Health and Safety functions
Each player can enable or disable four trigger logics for the Segmented Passthrough:
Proximity: This sets the opacity of an overlay passthrough layer when moving closer to another participant. The closer you get, the more visible the passthrough layer becomes
Momentum: Show a passthrough cutout of a player which walks around. The opacity is defined by their corresponding walking speed. The faster, the more visible the passthrough layer becomes.
Movement: Show a passthrough cutout of all other players around their position when I move my head by walking around.
Toggle passthrough: Switch passthrough on and off.
Segmented Passthrough
The Segmented Passthrough applies a cutout to other co-located users. The cutout is wider than the avatar to account for pose mis-estimation and extends to include the lower body. The Health & Safety functions update the Segmented Passthrough to be triggered by proximity (shown below) or relative speed (Movement or Momentum Passthrough), or both.
The Passthrough API provides real-time visualization of the physical world while in VR:
If the spatial mapping of the avatar to the user’s physical position is not aligned, issues arise with the mismatch between visual and auditory information. Segmented Passthrough could be employed as a mechanism to warn users of the physical position of other co-located users.
Re-spawning creates another instance where an avatar may be absent, so there is no indication of the physical location of co-located, respawning users. Again, Segmented Passthrough could be employed as a mechanism to warn users of the physical position of other co-located users.
Cube gimmick
You can spawn and explode cubes in the showcase level, this is available for all users all the time. The cubes are replicated over the network.