docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Face tracking

    This page is a supplement to the AR Foundation Face tracking manual. The following sections only contain information about APIs where ARCore 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.

    Face regions

    The ARCore face subsystem provides face tracking methods that allow access to "regions". Regions are specific to ARCore. ARCore provides access to the following regions that define features on a face:

    • Nose tip
    • Forehead left
    • Forehead right

    Each region has a Pose associated with it. To access face regions, obtain an instance of the ARCoreFaceSubsystem using the following script:

    XRFaceSubsystem faceSubsystem = ...
    #if UNITY_ANDROID
    var arcoreFaceSubsystem = faceSubsystem as ARCoreFaceSubsystem;
    if (arcoreFaceSubsystem != null)
    {
        var regionData = new NativeArray<ARCoreFaceRegionData>(0, Allocator.Temp);
        arcoreFaceSubsystem.GetRegionPoses(faceId, Allocator.Temp, ref regionData);
        using (regionData)
        {
            foreach (var data in regionData)
            {
                Debug.LogFormat("Region {0} is at {1}", data.region, data.pose);
            }
        }
    }
    #endif
    
    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)