Skip to content

Commit

Permalink
good enough openxr
Browse files Browse the repository at this point in the history
  • Loading branch information
dooly123 committed Mar 4, 2025
1 parent b8f3684 commit b5aa4bf
Show file tree
Hide file tree
Showing 14 changed files with 440 additions and 70 deletions.
96 changes: 89 additions & 7 deletions Basis/Assets/XR/Settings/OpenXR Package Settings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: e573a2aed6698b047aff95224499b722, type: 3}
m_Name: MetaXREyeTrackedFoveationFeature Standalone
m_EditorClassIdentifier:
m_enabled: 0
m_enabled: 1
nameUi: Meta XR Eye Tracked Foveation
version: 0.0.1
featureIdInternal: com.meta.openxr.feature.eyetrackedfoveation
Expand Down Expand Up @@ -852,7 +852,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: e573a2aed6698b047aff95224499b722, type: 3}
m_Name: MetaXREyeTrackedFoveationFeature Android
m_EditorClassIdentifier:
m_enabled: 0
m_enabled: 1
nameUi: Meta XR Eye Tracked Foveation
version: 0.0.1
featureIdInternal: com.meta.openxr.feature.eyetrackedfoveation
Expand Down Expand Up @@ -1007,6 +1007,26 @@ MonoBehaviour:
company: HTC
priority: 0
required: 0
--- !u!114 &638815009775519648
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e314dfef9af0904e80129bcc0a79361, type: 3}
m_Name: HandTracking Standalone
m_EditorClassIdentifier:
m_enabled: 0
nameUi: Hand Tracking Subsystem
version: 0.0.1
featureIdInternal: com.unity.openxr.feature.input.handtracking
openxrExtensionStrings: XR_EXT_hand_tracking
company: Unity
priority: -100
required: 0
--- !u!114 &1037941242733295319
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1131,6 +1151,26 @@ MonoBehaviour:
extensionStrings:
- XR_KHR_binding_modification
- XR_EXT_dpad_binding
--- !u!114 &1981983295813178899
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e314dfef9af0904e80129bcc0a79361, type: 3}
m_Name: HandTracking Android
m_EditorClassIdentifier:
m_enabled: 0
nameUi:
version:
featureIdInternal:
openxrExtensionStrings:
company:
priority: 0
required: 0
--- !u!114 &2146913422818440268
MonoBehaviour:
m_ObjectHideFlags: 0
Expand All @@ -1152,6 +1192,26 @@ MonoBehaviour:
priority: 0
required: 0
ignoreValidationErrors: 0
--- !u!114 &2273204849974885035
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b3aced3429e5911458f4da2dac9d0f29, type: 3}
m_Name: MetaHandTrackingAim Android
m_EditorClassIdentifier:
m_enabled: 0
nameUi:
version:
featureIdInternal:
openxrExtensionStrings:
company:
priority: 0
required: 0
--- !u!114 &2666689914590433523
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1186,7 +1246,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: f028123e2efe1d443875bc7609b4a98b, type: 3}
m_Name: PalmPoseInteraction Android
m_EditorClassIdentifier:
m_enabled: 0
m_enabled: 1
nameUi: Palm Pose
version: 0.0.1
featureIdInternal: com.unity.openxr.feature.input.palmpose
Expand Down Expand Up @@ -1271,14 +1331,34 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4710975c7840e7d499bbb3757c22b0a5, type: 3}
m_Name: MetaXRSubsampledLayout Android
m_EditorClassIdentifier:
m_enabled: 0
m_enabled: 1
nameUi: Meta XR Subsampled Layout
version: 0.0.1
featureIdInternal: com.meta.openxr.feature.subsampledLayout
openxrExtensionStrings: XR_META_vulkan_swapchain_create_info
company: Meta
priority: 0
required: 0
--- !u!114 &3999078036332178412
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b3aced3429e5911458f4da2dac9d0f29, type: 3}
m_Name: MetaHandTrackingAim Standalone
m_EditorClassIdentifier:
m_enabled: 0
nameUi: Meta Hand Tracking Aim
version: 0.0.1
featureIdInternal: com.unity.openxr.feature.input.metahandtrackingaim
openxrExtensionStrings: XR_FB_hand_tracking_aim
company: Unity
priority: 0
required: 0
--- !u!114 &4031459642842490951
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1332,6 +1412,8 @@ MonoBehaviour:
m_Name: Standalone
m_EditorClassIdentifier:
features:
- {fileID: 3999078036332178412}
- {fileID: 638815009775519648}
- {fileID: -4823766194161132787}
- {fileID: 1818262454267888816}
- {fileID: 2776206606949624213}
Expand Down Expand Up @@ -1471,7 +1553,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4710975c7840e7d499bbb3757c22b0a5, type: 3}
m_Name: MetaXRSubsampledLayout Standalone
m_EditorClassIdentifier:
m_enabled: 0
m_enabled: 1
nameUi: Meta XR Subsampled Layout
version: 0.0.1
featureIdInternal: com.meta.openxr.feature.subsampledLayout
Expand All @@ -1491,7 +1573,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: f028123e2efe1d443875bc7609b4a98b, type: 3}
m_Name: PalmPoseInteraction Standalone
m_EditorClassIdentifier:
m_enabled: 0
m_enabled: 1
nameUi: Palm Pose
version: 0.0.1
featureIdInternal: com.unity.openxr.feature.input.palmpose
Expand Down Expand Up @@ -1647,7 +1729,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 81954520b8bbd2f458104fe69f5a7680, type: 3}
m_Name: MetaXRSpaceWarp Android
m_EditorClassIdentifier:
m_enabled: 0
m_enabled: 1
nameUi: Meta XR Space Warp
version: 1.0.0
featureIdInternal: com.meta.openxr.feature.spacewarp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,4 @@ public override async void OnInspectorGUI()
}
}
*/
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public abstract class BasisInput : MonoBehaviour
public BasisInputState InputState = new BasisInputState();
[SerializeField]
public BasisInputState LastState = new BasisInputState();
public BasisGeneralLocation GeneralLocation;
public static BasisBoneTrackedRole[] CanHaveMultipleRoles = new BasisBoneTrackedRole[] { BasisBoneTrackedRole.LeftHand, BasisBoneTrackedRole.RightHand };
public bool TryGetRole(out BasisBoneTrackedRole BasisBoneTrackedRole)
{
Expand Down Expand Up @@ -396,40 +395,7 @@ public void LastUpdatePlayerControl()
{
InputState.CopyTo(LastState);
}
public void ShowTrackedVisual()
{
if (BasisVisualTracker == null && LoadedDeviceRequest == null)
{
BasisDeviceMatchSettings Match = BasisDeviceManagement.Instance.BasisDeviceNameMatcher.GetAssociatedDeviceMatchableNames(CommonDeviceIdentifier);
if (Match.CanDisplayPhysicalTracker)
{
var op = Addressables.LoadAssetAsync<GameObject>(Match.DeviceID);
GameObject go = op.WaitForCompletion();
GameObject gameObject = Object.Instantiate(go);
gameObject.name = CommonDeviceIdentifier;
gameObject.transform.parent = this.transform;
if (gameObject.TryGetComponent(out BasisVisualTracker))
{
BasisVisualTracker.Initialization(this);
}
}
else
{
if (UseFallbackModel())
{
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle<GameObject> op = Addressables.LoadAssetAsync<GameObject>(FallbackDeviceID);
GameObject go = op.WaitForCompletion();
GameObject gameObject = Object.Instantiate(go);
gameObject.name = CommonDeviceIdentifier;
gameObject.transform.parent = this.transform;
if (gameObject.TryGetComponent(out BasisVisualTracker))
{
BasisVisualTracker.Initialization(this);
}
}
}
}
}
public abstract void ShowTrackedVisual();
public bool UseFallbackModel()
{
if (hasRoleAssigned == false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Basis.Scripts.Drivers;
using Basis.Scripts.TransformBinders.BoneControl;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.InputSystem;
namespace Basis.Scripts.Device_Management.Devices.Desktop
{
Expand Down Expand Up @@ -157,6 +158,41 @@ public override void DoPollData()
UpdatePlayerControl();
}
}
public override void ShowTrackedVisual()
{
if (BasisVisualTracker == null && LoadedDeviceRequest == null)
{
BasisDeviceMatchSettings Match = BasisDeviceManagement.Instance.BasisDeviceNameMatcher.GetAssociatedDeviceMatchableNames(CommonDeviceIdentifier);
if (Match.CanDisplayPhysicalTracker)
{
var op = Addressables.LoadAssetAsync<GameObject>(Match.DeviceID);
GameObject go = op.WaitForCompletion();
GameObject gameObject = Object.Instantiate(go);
gameObject.name = CommonDeviceIdentifier;
gameObject.transform.parent = this.transform;
if (gameObject.TryGetComponent(out BasisVisualTracker))
{
BasisVisualTracker.Initialization(this);
}
}
else
{
if (UseFallbackModel())
{
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle<GameObject> op = Addressables.LoadAssetAsync<GameObject>(FallbackDeviceID);
GameObject go = op.WaitForCompletion();
GameObject gameObject = Object.Instantiate(go);
gameObject.name = CommonDeviceIdentifier;
gameObject.transform.parent = this.transform;
if (gameObject.TryGetComponent(out BasisVisualTracker))
{
BasisVisualTracker.Initialization(this);
}
}
}
}
}

public BasisVirtualSpineDriver BasisVirtualSpine = new BasisVirtualSpineDriver();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
"GUID:35b9c7a103b322f43805bf1744257ac7",
"GUID:d8b63aba1907145bea998dd612889d6b",
"GUID:45c7722710e2a37438daaacbf1cd4ad1",
"GUID:5ad71426c7096f04a9e0f40eb9cf44db"
"GUID:5ad71426c7096f04a9e0f40eb9cf44db",
"GUID:9e24947de15b9834991c9d8411ea37cf",
"GUID:75c7734b9034adc43990fe961f586496",
"GUID:84651a3751eca9349aac36a66bba901b"
],
"includePlatforms": [],
"excludePlatforms": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Threading.Tasks;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.AddressableAssets;
using Valve.VR;

namespace Basis.Scripts.Device_Management.Devices.OpenVR
Expand Down Expand Up @@ -66,5 +67,39 @@ public override void DoPollData()
}
}
}
public override void ShowTrackedVisual()
{
if (BasisVisualTracker == null && LoadedDeviceRequest == null)
{
BasisDeviceMatchSettings Match = BasisDeviceManagement.Instance.BasisDeviceNameMatcher.GetAssociatedDeviceMatchableNames(CommonDeviceIdentifier);
if (Match.CanDisplayPhysicalTracker)
{
var op = Addressables.LoadAssetAsync<GameObject>(Match.DeviceID);
GameObject go = op.WaitForCompletion();
GameObject gameObject = Object.Instantiate(go);
gameObject.name = CommonDeviceIdentifier;
gameObject.transform.parent = this.transform;
if (gameObject.TryGetComponent(out BasisVisualTracker))
{
BasisVisualTracker.Initialization(this);
}
}
else
{
if (UseFallbackModel())
{
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle<GameObject> op = Addressables.LoadAssetAsync<GameObject>(FallbackDeviceID);
GameObject go = op.WaitForCompletion();
GameObject gameObject = Object.Instantiate(go);
gameObject.name = CommonDeviceIdentifier;
gameObject.transform.parent = this.transform;
if (gameObject.TryGetComponent(out BasisVisualTracker))
{
BasisVisualTracker.Initialization(this);
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Basis.Scripts.TransformBinders.BoneControl;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.AddressableAssets;
using Valve.VR;

namespace Basis.Scripts.Device_Management.Devices.OpenVR
Expand Down Expand Up @@ -126,5 +127,39 @@ public void GetEstimatedPeakVelocities(out Vector3 velocity, out Vector3 angular
public bool isValid { get { return poseAction[inputSource].poseIsValid; } }
public bool isActive { get { return poseAction[inputSource].active; } }
#endregion
public override void ShowTrackedVisual()
{
if (BasisVisualTracker == null && LoadedDeviceRequest == null)
{
BasisDeviceMatchSettings Match = BasisDeviceManagement.Instance.BasisDeviceNameMatcher.GetAssociatedDeviceMatchableNames(CommonDeviceIdentifier);
if (Match.CanDisplayPhysicalTracker)
{
var op = Addressables.LoadAssetAsync<GameObject>(Match.DeviceID);
GameObject go = op.WaitForCompletion();
GameObject gameObject = Object.Instantiate(go);
gameObject.name = CommonDeviceIdentifier;
gameObject.transform.parent = this.transform;
if (gameObject.TryGetComponent(out BasisVisualTracker))
{
BasisVisualTracker.Initialization(this);
}
}
else
{
if (UseFallbackModel())
{
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle<GameObject> op = Addressables.LoadAssetAsync<GameObject>(FallbackDeviceID);
GameObject go = op.WaitForCompletion();
GameObject gameObject = Object.Instantiate(go);
gameObject.name = CommonDeviceIdentifier;
gameObject.transform.parent = this.transform;
if (gameObject.TryGetComponent(out BasisVisualTracker))
{
BasisVisualTracker.Initialization(this);
}
}
}
}
}
}
}
Loading

0 comments on commit b5aa4bf

Please sign in to comment.