// %BANNER_BEGIN% // --------------------------------------------------------------------- // %COPYRIGHT_BEGIN% // Copyright (c) (2019-2024) Magic Leap, Inc. All Rights Reserved. // Use of this file is governed by the Software License Agreement, located here: https://www.magicleap.com/software-license-agreement-ml2 // Terms and conditions applicable to third-party materials accompanying this distribution may also be found in the top-level NOTICE file appearing herein. // %COPYRIGHT_END% // --------------------------------------------------------------------- // %BANNER_END% using System; using System.Collections.Generic; namespace UnityEngine.XR.MagicLeap { public static partial class InputSubsystem { public static class Utils { /// /// Retrieves a Magic Leap input device that matches the specified . /// /// The characteristics to match against input devices. /// /// A valid that matches the specified characteristics. /// If no matching device is found, an invalid is returned (i.e., will be false). /// public static InputDevice FindMagicLeapDevice(InputDeviceCharacteristics inputDeviceCharacteristics) { List devices = new List(); InputDevices.GetDevicesWithCharacteristics(inputDeviceCharacteristics, devices); foreach (InputDevice device in devices) { if (device.name.Contains("MagicLeap") || MLDevice.IsOpenXRLoaderActive() && device.isValid) { return device; } } return new InputDevice(); } /// /// Instructs the input subsystem to use MLPerceptionGetPerdictedSnapshot by default. /// /// /// Time representing the time in ms for which to predict poses (the max value is 100 ms). /// This timestamp typically comes from out_frame_info.predicted_display_time. /// /// Boolean representing whether or not to predict the snapshot. public static void PredictSnapshot(long timestamp, bool predictSnapshots) => MagicLeapXrProviderNativeBindings.PredictSnapshot(timestamp, predictSnapshots); /// /// Resets the snapshot prediction state of the input subsystem. /// Call this method to clean up after using . /// public static void ResetSnapshotPrediction() => MagicLeapXrProviderNativeBindings.ResetSnapshotPrediction(); } } }