docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Session

    This page is a supplement to the AR Foundation Session manual. The following sections only contain information about APIs where Meta Quest exhibits unique platform-specific behavior.

    Tip

    When developing an AR app, refer to both the AR Foundation documentation as well as the required packages for each platform you support.

    Scene capture

    Unlike other AR platforms, Meta OpenXR does not dynamically detect trackables at runtime. Instead, Meta's OpenXR runtime queries the device's Space Setup data and returns information stored in its Scene Model. In the Meta OpenXR API, this Space Setup process is referred to as scene capture.

    During scene capture, the device presents an interface where users can label surfaces and objects in their environment such as walls and furniture. When scene capture is complete, the Scene Model is saved to the device and persists across applications and sessions.

    A Meta Quest 3 screenshot shows a small room with a table rendered via Passthrough. A bounding box is drawn around the table as part of the interface for scene capture.
    Scene capture shown on a Quest 3.

    Note

    The user interface for scene capture varies depending on which Meta Quest device is used, but all devices support the same OpenXR API.

    The user can initiate scene capture any time via the Space Setup option in Settings, and your app can also initiate scene capture any time via the scene capture API.

    Tip

    Due to current limitations of tracking technology, it is possible that detected planes and other trackables can become misaligned with their physical counterparts over the duration of an AR session. As a workaround for this issue, you can give users the option to initiate scene capture from within your app, allowing them to realign the bounding boxes of trackables in their space.

    Life cycle

    The scene capture life cycle consists of four phases:

    1. You request to initiate scene capture.
    2. If the request was successful, on a subsequent frame Unity invokes MonoBehaviour.OnApplicationPause(bool), passing true. Your app is suspended during scene capture.
    3. The user completes scene capture as prompted by the device.
    4. Unity resumes and invokes OnApplicationPause again, passing false.

    Code sample

    Use MetaOpenXRSessionSubsystem.TryRequestSceneCapture to initiate scene capture, as shown below:

    // Getting a reference to the ARSession at runtime is not optimal.
    // For better runtime performance, reuse a saved reference to the ARSession instead
    var arSession = Object.FindAnyObjectByType<ARSession>();
    
    // To access the scene capture API,
    // cast the ARSession's subsystem to MetaOpenXRSessionSubsystem
    var success = (arSession.subsystem as MetaOpenXRSessionSubsystem)
        .TryRequestSceneCapture();
    
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)