KevinF45 Posted October 8, 2021 Share Posted October 8, 2021 We are sometimes building for both Focus Plus and Focus 3, and would like to distinguish between the two using an API call. I don't see one off hand. They both seem to show as "WVR Display Provider" from UnityEngine.XR.XRSettings.loadedDeviceName or "WVR HMD" from InputDevices.GetDevices() name. Is there an API that we can use to tell the difference? Link to comment Share on other sites More sharing options...
Tony PH Lin Posted November 12, 2021 Share Posted November 12, 2021 Sample code by using Essence API: using Wave.Essence; var controller_r = WXRDevice.GetRoleDevice(XR_Device.Right); if (controller_r.TryGetFeatureValue(CommonUsages.isTracked, out bool value)) string rightControllerInfo = controller_r.name + " is tracked."; If you used the InputDevices.GetDevices, you have to check the characteristic of left/right/head devices. Sample code by using UnityEngine.XR: /// <summary> Wave Head Mounted Device Characteristics </summary> const InputDeviceCharacteristics kHMDCharacteristics = ( InputDeviceCharacteristics.HeadMounted | InputDeviceCharacteristics.Camera | InputDeviceCharacteristics.TrackedDevice ); /// <summary> Wave Left Controller Characteristics </summary> const InputDeviceCharacteristics kControllerLeftCharacteristics = ( InputDeviceCharacteristics.Left | InputDeviceCharacteristics.TrackedDevice | InputDeviceCharacteristics.Controller | InputDeviceCharacteristics.HeldInHand ); /// <summary> Wave Right Controller Characteristics </summary> const InputDeviceCharacteristics kControllerRightCharacteristics = ( InputDeviceCharacteristics.Right | InputDeviceCharacteristics.TrackedDevice | InputDeviceCharacteristics.Controller | InputDeviceCharacteristics.HeldInHand var inputDevices = new List<UnityEngine.XR.InputDevice>(); InputDevices.GetDevices(inputDevices); foreach (UnityEngine.XR.InputDevice id in inputDevices) bool isRight = id.characteristics.Equals(kControllerRightCharacteristics); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now