diff --git a/Basis/Assets/AddressableAssetsData/AddressableAssetSettings.asset b/Basis/Assets/AddressableAssetsData/AddressableAssetSettings.asset index 748c4f2c3..dc935718e 100644 --- a/Basis/Assets/AddressableAssetsData/AddressableAssetSettings.asset +++ b/Basis/Assets/AddressableAssetsData/AddressableAssetSettings.asset @@ -15,7 +15,7 @@ MonoBehaviour: m_DefaultGroup: 37c75a6cf72db324eb01200602299fc8 m_currentHash: serializedVersion: 2 - Hash: 00000000000000000000000000000000 + Hash: 1266d874380a471b501558b174201c86 m_OptimizeCatalogSize: 0 m_BuildRemoteCatalog: 0 m_CatalogRequestsTimeout: 0 diff --git a/Basis/Assets/AddressableAssetsData/Linux.meta b/Basis/Assets/AddressableAssetsData/Linux.meta new file mode 100644 index 000000000..b3b2e5967 --- /dev/null +++ b/Basis/Assets/AddressableAssetsData/Linux.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3d3e1ebab14341f4cb3af6d4d961db43 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Basis/Assets/Basis/Settings/Quality Settiings/Modified - Desktop.asset b/Basis/Assets/Basis/Settings/Quality Settiings/Modified - Desktop.asset index f1feda271..ef5cdae3d 100644 --- a/Basis/Assets/Basis/Settings/Quality Settiings/Modified - Desktop.asset +++ b/Basis/Assets/Basis/Settings/Quality Settiings/Modified - Desktop.asset @@ -23,9 +23,9 @@ MonoBehaviour: m_RequireOpaqueTexture: 1 m_OpaqueDownsampling: 1 m_SupportsTerrainHoles: 0 - m_SupportsHDR: 0 - m_HDRColorBufferPrecision: 0 - m_MSAA: 8 + m_SupportsHDR: 1 + m_HDRColorBufferPrecision: 1 + m_MSAA: 1 m_RenderScale: 1 m_UpscalingFilter: 0 m_FsrOverrideSharpness: 0 diff --git a/Basis/Assets/Basis/Settings/Quality Settiings/Modified - Quest.asset b/Basis/Assets/Basis/Settings/Quality Settiings/Modified - Quest.asset index 4f975af1d..06765658c 100644 --- a/Basis/Assets/Basis/Settings/Quality Settiings/Modified - Quest.asset +++ b/Basis/Assets/Basis/Settings/Quality Settiings/Modified - Quest.asset @@ -25,7 +25,7 @@ MonoBehaviour: m_SupportsTerrainHoles: 0 m_SupportsHDR: 0 m_HDRColorBufferPrecision: 0 - m_MSAA: 2 + m_MSAA: 0 m_RenderScale: 1 m_UpscalingFilter: 0 m_FsrOverrideSharpness: 0 diff --git a/Basis/Assets/Basis/Settings/Unity Rendering Defaults/UniversalRenderPipelineGlobalSettings.asset b/Basis/Assets/Basis/Settings/Unity Rendering Defaults/UniversalRenderPipelineGlobalSettings.asset index 153ceac9c..2f12d4d37 100644 --- a/Basis/Assets/Basis/Settings/Unity Rendering Defaults/UniversalRenderPipelineGlobalSettings.asset +++ b/Basis/Assets/Basis/Settings/Unity Rendering Defaults/UniversalRenderPipelineGlobalSettings.asset @@ -36,25 +36,25 @@ MonoBehaviour: - rid: 2858994164428701698 - rid: 2858994164428701699 - rid: 2858994164428701700 - - rid: 3153963477245886578 + - rid: 3153963562537582962 - rid: 2858994164428701702 - rid: 2858994164428701703 - - rid: 3153963477245886579 - - rid: 3153963477245886580 + - rid: 3153963562537582963 + - rid: 3153963562537582964 - rid: 2858994164428701706 - - rid: 3153963477245886581 + - rid: 3153963562537582965 - rid: 2858994164428701708 - rid: 3153963444920385929 - - rid: 3153963477245886582 - - rid: 3153963477245886583 - - rid: 3153963477245886584 - - rid: 3153963477245886585 - - rid: 3153963477245886586 - - rid: 3153963477245886587 + - rid: 3153963562537582966 + - rid: 3153963562537582967 + - rid: 3153963562537582938 + - rid: 3153963562537582968 + - rid: 3153963562537582969 + - rid: 3153963562537582941 - rid: 2858994164428701716 - rid: 2858994164428701717 - rid: 2858994164428701718 - - rid: 3153963477245886588 + - rid: 3153963562537582970 m_RuntimeSettings: m_List: - rid: 2858994164428701698 @@ -65,6 +65,8 @@ MonoBehaviour: - rid: 2858994164428701706 - rid: 2858994164428701708 - rid: 3153963444920385929 + - rid: 3153963562537582938 + - rid: 3153963562537582941 - rid: 2858994164428701716 - rid: 2858994164428701717 - rid: 2858994164428701718 @@ -171,7 +173,19 @@ MonoBehaviour: m_OcclusionCullingDebugKernels: {fileID: 7200000, guid: b23e766bcf50ca4438ef186b174557df, type: 3} m_DebugOcclusionTestPS: {fileID: 4800000, guid: d3f0849180c2d0944bc71060693df100, type: 3} m_DebugOccluderPS: {fileID: 4800000, guid: b3c92426a88625841ab15ca6a7917248, type: 3} - - rid: 3153963477245886578 + - rid: 3153963562537582938 + type: {class: ProbeVolumeGlobalSettings, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime} + data: + m_Version: 1 + m_ProbeVolumeDisableStreamingAssets: 1 + - rid: 3153963562537582941 + type: {class: ProbeVolumeRuntimeResources, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime} + data: + m_Version: 1 + probeVolumeBlendStatesCS: {fileID: 7200000, guid: a3f7b8c99de28a94684cb1daebeccf5d, type: 3} + probeVolumeUploadDataCS: {fileID: 7200000, guid: 0951de5992461754fa73650732c4954c, type: 3} + probeVolumeUploadDataL2CS: {fileID: 7200000, guid: 6196f34ed825db14b81fb3eb0ea8d931, type: 3} + - rid: 3153963562537582962 type: {class: Renderer2DResources, ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.Runtime} data: m_Version: 0 @@ -186,14 +200,14 @@ MonoBehaviour: m_DefaultLitMaterial: {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2} m_DefaultUnlitMaterial: {fileID: 2100000, guid: 9dfc825aed78fcd4ba02077103263b40, type: 2} m_DefaultMaskMaterial: {fileID: 2100000, guid: 15d0c3709176029428a0da2f8cecf0b5, type: 2} - - rid: 3153963477245886579 + - rid: 3153963562537582963 type: {class: URPShaderStrippingSetting, ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.Runtime} data: m_Version: 0 m_StripUnusedPostProcessingVariants: 1 m_StripUnusedVariants: 1 m_StripScreenCoordOverrideVariants: 1 - - rid: 3153963477245886580 + - rid: 3153963562537582964 type: {class: UniversalRenderPipelineEditorMaterials, ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.Runtime} data: m_DefaultMaterial: {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} @@ -202,7 +216,7 @@ MonoBehaviour: m_DefaultTerrainMaterial: {fileID: 2100000, guid: 594ea882c5a793440b60ff72d896021e, type: 2} m_DefaultDecalMaterial: {fileID: 2100000, guid: 31d0dcc6f2dd4e4408d18036a2c93862, type: 2} m_DefaultSpriteMaterial: {fileID: 2100000, guid: 9dfc825aed78fcd4ba02077103263b40, type: 2} - - rid: 3153963477245886581 + - rid: 3153963562537582965 type: {class: UniversalRenderPipelineEditorShaders, ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.Runtime} data: m_AutodeskInteractive: {fileID: 4800000, guid: 0e9d5a909a1f7e84882a534d0d11e49f, type: 3} @@ -214,13 +228,13 @@ MonoBehaviour: m_DefaultSpeedTree7Shader: {fileID: 4800000, guid: 0f4122b9a743b744abe2fb6a0a88868b, type: 3} m_DefaultSpeedTree8Shader: {fileID: -6465566751694194690, guid: 9920c1f1781549a46ba081a2a15a16ec, type: 3} m_DefaultSpeedTree9Shader: {fileID: -6465566751694194690, guid: cbd3e1cc4ae141c42a30e33b4d666a61, type: 3} - - rid: 3153963477245886582 + - rid: 3153963562537582966 type: {class: STP/RuntimeResources, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime} data: m_setupCS: {fileID: 7200000, guid: 33be2e9a5506b2843bdb2bdff9cad5e1, type: 3} m_preTaaCS: {fileID: 7200000, guid: a679dba8ec4d9ce45884a270b0e22dda, type: 3} m_taaCS: {fileID: 7200000, guid: 3923900e2b41b5e47bc25bfdcbcdc9e6, type: 3} - - rid: 3153963477245886583 + - rid: 3153963562537582967 type: {class: ProbeVolumeBakingResources, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime} data: m_Version: 1 @@ -233,12 +247,7 @@ MonoBehaviour: skyOcclusionRT: {fileID: -5126288278712620388, guid: 5a2a534753fbdb44e96c3c78b5a6999d, type: 3} renderingLayerCS: {fileID: -6772857160820960102, guid: 94a070d33e408384bafc1dea4a565df9, type: 3} renderingLayerRT: {fileID: -5126288278712620388, guid: 94a070d33e408384bafc1dea4a565df9, type: 3} - - rid: 3153963477245886584 - type: {class: ProbeVolumeGlobalSettings, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime} - data: - m_Version: 1 - m_ProbeVolumeDisableStreamingAssets: 1 - - rid: 3153963477245886585 + - rid: 3153963562537582968 type: {class: ProbeVolumeDebugResources, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime} data: m_Version: 1 @@ -248,21 +257,14 @@ MonoBehaviour: probeVolumeOffsetDebugShader: {fileID: 4800000, guid: db8bd7436dc2c5f4c92655307d198381, type: 3} probeSamplingDebugMesh: {fileID: -3555484719484374845, guid: 20be25aac4e22ee49a7db76fb3df6de2, type: 3} numbersDisplayTex: {fileID: 2800000, guid: 73fe53b428c5b3440b7e87ee830b608a, type: 3} - - rid: 3153963477245886586 + - rid: 3153963562537582969 type: {class: IncludeAdditionalRPAssets, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime} data: m_version: 0 m_IncludeReferencedInScenes: 0 m_IncludeAssetsByLabel: 0 m_LabelToInclude: - - rid: 3153963477245886587 - type: {class: ProbeVolumeRuntimeResources, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime} - data: - m_Version: 1 - probeVolumeBlendStatesCS: {fileID: 7200000, guid: a3f7b8c99de28a94684cb1daebeccf5d, type: 3} - probeVolumeUploadDataCS: {fileID: 7200000, guid: 0951de5992461754fa73650732c4954c, type: 3} - probeVolumeUploadDataL2CS: {fileID: 7200000, guid: 6196f34ed825db14b81fb3eb0ea8d931, type: 3} - - rid: 3153963477245886588 + - rid: 3153963562537582970 type: {class: UniversalRenderPipelineEditorAssets, ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.Runtime} data: m_DefaultSettingsVolumeProfile: {fileID: 11400000, guid: eda47df5b85f4f249abf7abd73db2cb2, type: 2} diff --git a/Basis/Assets/Oculus/VR.meta b/Basis/Assets/Oculus/VR.meta new file mode 100644 index 000000000..1ae827add --- /dev/null +++ b/Basis/Assets/Oculus/VR.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a1668b33be209d34ea88cca31c39d1c2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Basis/Assets/Oculus/VR/Editor.meta b/Basis/Assets/Oculus/VR/Editor.meta new file mode 100644 index 000000000..fc0435c0a --- /dev/null +++ b/Basis/Assets/Oculus/VR/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7cfa299ff84391842903ff8ef1367904 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Basis/Assets/Oculus/VR/Editor/Tools.meta b/Basis/Assets/Oculus/VR/Editor/Tools.meta new file mode 100644 index 000000000..10c3d2c38 --- /dev/null +++ b/Basis/Assets/Oculus/VR/Editor/Tools.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f7291be4823720d419bfc33762c3c962 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Basis/Assets/Oculus/VR/Editor/Tools/ovr-platform-util.exe b/Basis/Assets/Oculus/VR/Editor/Tools/ovr-platform-util.exe new file mode 100644 index 000000000..96aa1ee37 Binary files /dev/null and b/Basis/Assets/Oculus/VR/Editor/Tools/ovr-platform-util.exe differ diff --git a/Basis/Assets/Oculus/VR/Editor/Tools/ovr-platform-util.exe.meta b/Basis/Assets/Oculus/VR/Editor/Tools/ovr-platform-util.exe.meta new file mode 100644 index 000000000..6e7d0374e --- /dev/null +++ b/Basis/Assets/Oculus/VR/Editor/Tools/ovr-platform-util.exe.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 0925160f0c3ca2542ad9e1e12b7342ee +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Basis/Assets/Plugins/Android/AndroidManifest.xml b/Basis/Assets/Plugins/Android/AndroidManifest.xml index 99b5a2e26..d2455109a 100644 --- a/Basis/Assets/Plugins/Android/AndroidManifest.xml +++ b/Basis/Assets/Plugins/Android/AndroidManifest.xml @@ -16,4 +16,6 @@ + + \ No newline at end of file diff --git a/Basis/Assets/Resources/InputActions.asset b/Basis/Assets/Resources/InputActions.asset new file mode 100644 index 000000000..09821ad40 --- /dev/null +++ b/Basis/Assets/Resources/InputActions.asset @@ -0,0 +1,16 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +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: 8922a6ca86889d84f8371a29d37b6dc8, type: 3} + m_Name: InputActions + m_EditorClassIdentifier: + InputActionDefinitions: [] + InputActionSets: [] diff --git a/Basis/Assets/Resources/InputActions.asset.meta b/Basis/Assets/Resources/InputActions.asset.meta new file mode 100644 index 000000000..efa07b15d --- /dev/null +++ b/Basis/Assets/Resources/InputActions.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cd5bd0545f38f9f4290dc25592b8e58a +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Basis/Assets/Resources/OVRPlatformToolSettings.asset b/Basis/Assets/Resources/OVRPlatformToolSettings.asset index 0ac2533dc..f94feedb4 100644 --- a/Basis/Assets/Resources/OVRPlatformToolSettings.asset +++ b/Basis/Assets/Resources/OVRPlatformToolSettings.asset @@ -12,11 +12,77 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: cd7bb81df5b74b34dadbf531f381a26b, type: 3} m_Name: OVRPlatformToolSettings m_EditorClassIdentifier: - riftRedistPackages: [] + riftRedistPackages: + - include: 0 + name: ' .NET Framework 3.5' + id: ' 606493776156948 ' + - include: 0 + name: ' .NET Framework 4.0' + id: ' 133610290311340 ' + - include: 0 + name: ' .NET Framework 4.5.1' + id: ' 1617306711884127 ' + - include: 0 + name: ' .NET Framework 4.7.1' + id: ' 1667821599930345 ' + - include: 0 + name: ' DirectX (June 2010)' + id: ' 822786567843179 ' + - include: 0 + name: ' OpenAL 1.1' + id: ' 1147517301974655 ' + - include: 0 + name: ' Visual C++ 2005' + id: ' 1604897159783747 ' + - include: 0 + name: ' Visual C++ 2008' + id: ' 118440348500045 ' + - include: 0 + name: ' Visual C++ 2010' + id: ' 532320330249657 ' + - include: 0 + name: ' Visual C++ 2010 x86' + id: ' 1008652072555515 ' + - include: 0 + name: ' Visual C++ 2012' + id: ' 1683508698536289 ' + - include: 0 + name: ' Visual C++ 2012 x86' + id: ' 1002692246447245 ' + - include: 0 + name: ' Visual C++ 2013' + id: ' 1675031999409058 ' + - include: 0 + name: ' Visual C++ 2013 x86' + id: ' 910524935693407 ' + - include: 0 + name: ' Visual C++ 2015 Update 3' + id: ' 1183534128364060 ' + - include: 0 + name: ' Visual C++ 2015 x86 Update 3' + id: ' 1113033105419344 ' + - include: 0 + name: ' Visual C++ 2017' + id: ' 1315322525257173 ' + - include: 0 + name: ' Visual C++ 2017 x86' + id: ' 1064693870299984 ' + - include: 0 + name: ' Visual C++ 2019' + id: ' 2657209094360789 ' + - include: 0 + name: ' Visual C++ 2019 x86' + id: ' 2556834837738356 ' + - include: 0 + name: ' Vulkan Runtime 1.0.65.1' + id: ' 1824471960899274 ' + - include: 0 + name: ' Vulkan Runtime 1.1.73.0' + id: ' 1941020095932382 ' languagePackDirectory: assetConfigs: - configList: [] - configList: [] - configList: [] - targetPlatform: 3 - runOvrLint: 1 + targetPlatform: 2 + runOvrLint: 0 diff --git a/Basis/Assets/StreamingAssets/RuntimeActionBindings.json b/Basis/Assets/StreamingAssets/RuntimeActionBindings.json index e69de29bb..37487d1d3 100644 --- a/Basis/Assets/StreamingAssets/RuntimeActionBindings.json +++ b/Basis/Assets/StreamingAssets/RuntimeActionBindings.json @@ -0,0 +1 @@ +{"InputActionDefinitions": [],"InputActionSets": []} \ No newline at end of file diff --git a/Basis/Assets/XR/Settings/OpenXR Package Settings.asset b/Basis/Assets/XR/Settings/OpenXR Package Settings.asset index af164883d..fd58ee2a8 100644 --- a/Basis/Assets/XR/Settings/OpenXR Package Settings.asset +++ b/Basis/Assets/XR/Settings/OpenXR Package Settings.asset @@ -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 @@ -699,7 +699,7 @@ MonoBehaviour: targetDevices: - visibleName: Quest manifestName: quest - enabled: 1 + enabled: 0 - visibleName: Quest 2 manifestName: quest2 enabled: 1 @@ -713,11 +713,11 @@ MonoBehaviour: manifestName: quest3s enabled: 1 forceRemoveInternetPermission: 0 - symmetricProjection: 0 + symmetricProjection: 1 foveatedRenderingApi: 0 - systemSplashScreen: {fileID: 0} + systemSplashScreen: {fileID: 2800000, guid: 93f0d4f9be07b5e4094ac46f24473eb1, type: 3} optimizeBufferDiscards: 1 - lateLatchingMode: 0 + lateLatchingMode: 1 lateLatchingDebug: 0 optimizeMultiviewRenderRegions: 0 spacewarpMotionVectorTextureFormat: 0 @@ -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 @@ -902,8 +902,8 @@ MonoBehaviour: m_List: 00000000 m_depthSubmissionMode: 1 m_spacewarpMotionVectorTextureFormat: 0 - m_optimizeBufferDiscards: 0 - m_symmetricProjection: 0 + m_optimizeBufferDiscards: 1 + m_symmetricProjection: 1 m_foveatedRenderingApi: 1 --- !u!114 &-8419463971566137 MonoBehaviour: @@ -1007,6 +1007,28 @@ 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 + k__BackingField: 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 + m_ShouldBeRunning: 0 --- !u!114 &1037941242733295319 MonoBehaviour: m_ObjectHideFlags: 0 @@ -1131,6 +1153,28 @@ 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 + k__BackingField: 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 + m_ShouldBeRunning: 0 --- !u!114 &2146913422818440268 MonoBehaviour: m_ObjectHideFlags: 0 @@ -1152,6 +1196,27 @@ 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 + k__BackingField: 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 &2666689914590433523 MonoBehaviour: m_ObjectHideFlags: 0 @@ -1186,7 +1251,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 @@ -1271,7 +1336,7 @@ 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 @@ -1279,6 +1344,27 @@ MonoBehaviour: 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 + k__BackingField: 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 @@ -1471,7 +1557,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 @@ -1491,7 +1577,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 @@ -1647,7 +1733,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 diff --git a/Basis/Packages/HVRBasisAvatarComms/Scripts/Actuation/EyeTrackingBoneActuation.cs b/Basis/Packages/HVRBasisAvatarComms/Scripts/Actuation/EyeTrackingBoneActuation.cs index ba88b4706..2cacb5158 100644 --- a/Basis/Packages/HVRBasisAvatarComms/Scripts/Actuation/EyeTrackingBoneActuation.cs +++ b/Basis/Packages/HVRBasisAvatarComms/Scripts/Actuation/EyeTrackingBoneActuation.cs @@ -156,16 +156,16 @@ private void SetEyeRotation(float x, float y, EyeSide side) { var xDeg = Mathf.Asin(x) * Mathf.Rad2Deg * multiplyX; var yDeg = Mathf.Asin(-y) * Mathf.Rad2Deg * multiplyY; - var euler = Quaternion.Euler(yDeg, xDeg, 0); + Quaternion Euler = Quaternion.Euler(yDeg, xDeg, 0); switch (side) { // FIXME: This wrongly assumes that eye bone transforms are oriented the same. // This needs to be fixed later by using the work-in-progress normalized muscle system instead. case EyeSide.Left: - _eyeFollowDriverLateInit.leftEyeTransform.localRotation = math.mul(_eyeFollowDriverLateInit.leftEyeInitialRotation, euler); + _eyeFollowDriverLateInit.leftEyeTransform.localRotation = math.mul(_eyeFollowDriverLateInit.leftEyeInitialRotation, Euler); break; case EyeSide.Right: - _eyeFollowDriverLateInit.rightEyeTransform.localRotation = math.mul(_eyeFollowDriverLateInit.rightEyeInitialRotation, euler); + _eyeFollowDriverLateInit.rightEyeTransform.localRotation = math.mul(_eyeFollowDriverLateInit.rightEyeInitialRotation, Euler); break; default: throw new ArgumentOutOfRangeException(nameof(side), side, null); @@ -173,17 +173,21 @@ private void SetEyeRotation(float x, float y, EyeSide side) } else { - if(_basisRemotePlayer != null) + if (_basisRemotePlayer != null) { switch (side) { case EyeSide.Left: - _basisRemotePlayer.NetworkReceiver.Eyes[0] = y; - _basisRemotePlayer.NetworkReceiver.Eyes[1] = x; + float result0 = (y + 1) / 2; + float result1 = (x + 1) / 2; + _basisRemotePlayer.NetworkReceiver.Eyes[0] = result0; + _basisRemotePlayer.NetworkReceiver.Eyes[1] = result1; break; case EyeSide.Right: - _basisRemotePlayer.NetworkReceiver.Eyes[2] = y; - _basisRemotePlayer.NetworkReceiver.Eyes[3] = x; + result0 = (y + 1) / 2; + result1 = (x + 1) / 2; + _basisRemotePlayer.NetworkReceiver.Eyes[2] = result0; + _basisRemotePlayer.NetworkReceiver.Eyes[3] = result1; break; default: throw new ArgumentOutOfRangeException(nameof(side), side, null); @@ -191,11 +195,10 @@ private void SetEyeRotation(float x, float y, EyeSide side) } } } - private void SetBuiltInEyeFollowDriverOverriden(bool value) { if (!_eyeFollowDriverLateInit) return; - _eyeFollowDriverLateInit.Override = value; + BasisLocalEyeFollowBase.Override = value; } private enum EyeSide diff --git a/Basis/Packages/HVRBasisAvatarComms/Scripts/FeatureNetworking/FeatureNetworking.cs b/Basis/Packages/HVRBasisAvatarComms/Scripts/FeatureNetworking/FeatureNetworking.cs index 85d613116..d9ecf9087 100644 --- a/Basis/Packages/HVRBasisAvatarComms/Scripts/FeatureNetworking/FeatureNetworking.cs +++ b/Basis/Packages/HVRBasisAvatarComms/Scripts/FeatureNetworking/FeatureNetworking.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using Basis.Scripts.BasisSdk; @@ -313,4 +313,4 @@ public class RequestedFeature public float lower; public float upper; } -} \ No newline at end of file +} diff --git a/Basis/Packages/com.avionblock.opussharp/LICENSE.txt b/Basis/Packages/com.avionblock.opussharp/LICENSE.txt new file mode 100644 index 000000000..8aa26455d --- /dev/null +++ b/Basis/Packages/com.avionblock.opussharp/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) [year] [fullname] + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Basis/Packages/com.avionblock.opussharp/LICENSE.txt.meta b/Basis/Packages/com.avionblock.opussharp/LICENSE.txt.meta new file mode 100644 index 000000000..1a7978a65 --- /dev/null +++ b/Basis/Packages/com.avionblock.opussharp/LICENSE.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 34cba400de6ae1740b36e1e5a18e3bdd +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Basis/Packages/com.avionblock.opussharp/Opus_LICENSE_PLEASE_READ.txt b/Basis/Packages/com.avionblock.opussharp/Opus_LICENSE_PLEASE_READ.txt new file mode 100644 index 000000000..9c8c0cc9d --- /dev/null +++ b/Basis/Packages/com.avionblock.opussharp/Opus_LICENSE_PLEASE_READ.txt @@ -0,0 +1,22 @@ +Contributions to the collaboration shall not be considered confidential. + +Each contributor represents and warrants that it has the right and +authority to license copyright in its contributions to the collaboration. + +Each contributor agrees to license the copyright in the contributions +under the Modified (2-clause or 3-clause) BSD License or the Clear BSD License. + +Please see the IPR statements submitted to the IETF for the complete +patent licensing details: + +Xiph.Org Foundation: +https://datatracker.ietf.org/ipr/1524/ + +Microsoft Corporation: +https://datatracker.ietf.org/ipr/1914/ + +Skype Limited: +https://datatracker.ietf.org/ipr/1602/ + +Broadcom Corporation: +https://datatracker.ietf.org/ipr/1526/ \ No newline at end of file diff --git a/Basis/Packages/com.avionblock.opussharp/Opus_LICENSE_PLEASE_READ.txt.meta b/Basis/Packages/com.avionblock.opussharp/Opus_LICENSE_PLEASE_READ.txt.meta new file mode 100644 index 000000000..c3324d36c --- /dev/null +++ b/Basis/Packages/com.avionblock.opussharp/Opus_LICENSE_PLEASE_READ.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 6b6db27b782def84c97337315f063695 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Basis/Packages/com.avionblock.opussharp/README.md b/Basis/Packages/com.avionblock.opussharp/README.md new file mode 100644 index 000000000..95159ec71 --- /dev/null +++ b/Basis/Packages/com.avionblock.opussharp/README.md @@ -0,0 +1,67 @@ +# OpusSharp +OpusSharp aims to be a cross platform, pure and ported C# compatible version of the native opus codec/library. The core library uses the native compiled DLL's/binaries. Currently, Windows, Android and Linux binaries are available. iOS and MacOS are in the works. OpusSharp compiles the opus binaries using a github actions file which is available [here](.github/workflows/OpusCompile.yml). + +> [!NOTE] +> While OpusSharp.Core contains minimal pre-made decoder and encoder handlers, you can create your own as all the SafeHandlers and NativeOpus functions are exposed and fully documented. However to get a minimal setup working, check the example below. + +## Basic NAudio Example +```cs +using NAudio.Wave; +using OpusSharp.Core; + +var format = new WaveFormat(48000, 2); +var buffer = new BufferedWaveProvider(format) { ReadFully = true }; +var encoder = new OpusEncoder(format.SampleRate, format.Channels, OpusPredefinedValues.OPUS_APPLICATION_VOIP); +var decoder = new OpusDecoder(format.SampleRate, format.Channels); +var recorder = new WaveInEvent() { BufferMilliseconds = 20, WaveFormat = format }; +var player = new WaveOutEvent(); +recorder.DataAvailable += Recorder_DataAvailable; + +recorder.StartRecording(); +player.Init(buffer); +player.Play(); + +void Recorder_DataAvailable(object? sender, WaveInEventArgs e) +{ + var encoded = new byte[1000]; + var encodedBytes = encoder.Encode(e.Buffer, 960, encoded, encoded.Length); + Console.WriteLine(encodedBytes); + var decoded = new byte[3840]; + var decodedSamples = decoder.Decode(encoded, encodedBytes, decoded, 960, false); + Console.WriteLine(decodedSamples); + buffer.AddSamples(decoded, 0, decoded.Length); +} + +Console.ReadLine(); +``` + +## CTL Example +```cs +using OpusSharp.Core; + +OpusEncoder encoder = new OpusEncoder(48000, 2, OpusPredefinedValues.OPUS_APPLICATION_VOIP); + +int vbr = 1; //1 == true, 0 == false +encoder.Ctl(EncoderCTL.OPUS_SET_VBR, ref vbr); //OpusSharp already checks if an error occurred with the CTL request and will throw an OpusException if there is an error, otherwise OpusErrorCodes.OPUS_OK. +``` + +## Supported Devices + +- ✅ Fully and natively supported. +- ❎ Can be supported but no reason to. +- ❗ Not yet available. +- ❌ Not planned, Not supported. + +|Device |x64|x86|arm32|arm64| +|-----------|---|---|-----|-----| +|Linux |✅ |✅ |✅ |✅ | +|Android |✅ |✅ |✅ |✅ | +|Windows |✅ |✅ |✅ |✅ | +|iOS |❗ |❗ |❗ |❗ | +|MacOS |❗ |❗ |❗ |❗ | + +## Installation +Please check [QuickStart](https://avionblock.github.io/OpusSharp/quick-start/index.html) OR [Nuget](https://www.nuget.org/packages/OpusSharp) + +## API Documentation +https://avionblock.github.io/OpusSharp/api/OpusSharp.Core.html diff --git a/Basis/Packages/com.avionblock.opussharp/README.md.meta b/Basis/Packages/com.avionblock.opussharp/README.md.meta new file mode 100644 index 000000000..762aa0a5c --- /dev/null +++ b/Basis/Packages/com.avionblock.opussharp/README.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 14c581031b9e7c24da944aae9ff8dbf7 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Basis/Packages/com.basis.console/BasisConsoleLogger.cs b/Basis/Packages/com.basis.console/BasisConsoleLogger.cs index 2209d93bd..419434807 100644 --- a/Basis/Packages/com.basis.console/BasisConsoleLogger.cs +++ b/Basis/Packages/com.basis.console/BasisConsoleLogger.cs @@ -1,3 +1,4 @@ +using Basis.Scripts.BasisSdk.Helpers; using Basis.Scripts.UI.UI_Panels; using System.Text; using TMPro; @@ -6,23 +7,27 @@ public class BasisConsoleLogger : BasisUIBase { public TextMeshProUGUI logText; - public bool showAllLogsInOrder = true; - public bool showCollapsedLogs = false; - public LogType currentLogTypeFilter = LogType.Log; + public static bool showAllLogsInOrder = true; + public static bool showCollapsedLogs = false; + public static LogType currentLogTypeFilter = LogType.Log; public TMP_Dropdown Dropdown; public Button ClearButton; public Button CollapseButton; public Button StopButton; public RectTransform Transform; - public bool IsUpdating = true; + public static bool IsUpdating = true; public TextMeshProUGUI CollapseButtonText; public TextMeshProUGUI StopButtonText; - public float updateInterval = 0.1f; // 100 milliseconds - public float timeSinceLastUpdate = 0f; public BasisButtonHeldCallBack BasisButtonHeldCallBack; public Button MouseLock; + public static BasisConsoleLogger Instance; + public static bool IsActive = false; private void Awake() { + if (BasisHelpers.CheckInstance(Instance)) + { + Instance = this; + } BasisLogManager.LoadLogsFromDisk(); Dropdown.onValueChanged.AddListener(HandlePressed); ClearButton.onClick.AddListener(ClearLogs); @@ -31,6 +36,7 @@ private void Awake() BasisButtonHeldCallBack.OnButtonReleased += OnButtonReleased; BasisButtonHeldCallBack.OnButtonPressed += OnButtonPressed; MouseLock.onClick.AddListener(ToggleMouse); + IsActive = true; } public Canvas Canvas; public void ToggleMouse() @@ -91,17 +97,11 @@ public void HandlePressed(int Value) } UpdateLogDisplay(); } - private void Update() + public static void QueryLogDisplay() { - if (IsUpdating && BasisLogManager.LogChanged) + if (IsActive && IsUpdating && BasisLogManager.LogChanged) { - timeSinceLastUpdate += Time.deltaTime; - - if (timeSinceLastUpdate >= updateInterval) - { - timeSinceLastUpdate = 0f; // Reset the timer - UpdateLogDisplay(); - } + Instance.UpdateLogDisplay(); } } @@ -136,7 +136,7 @@ private void UpdateLogDisplay() public void ClearLogs() { BasisLogManager.ClearLogs(); - logText.text = ""; + logText.text = string.Empty; } public override void DestroyEvent() @@ -148,4 +148,8 @@ public override void InitalizeEvent() { BasisCursorManagement.UnlockCursor(nameof(BasisConsoleLogger)); } -} \ No newline at end of file + public void OnDestroy() + { + IsActive = false; + } +} diff --git a/Basis/Packages/com.basis.console/BasisLogManager.cs b/Basis/Packages/com.basis.console/BasisLogManager.cs index ddff9466e..0bdce8d25 100644 --- a/Basis/Packages/com.basis.console/BasisLogManager.cs +++ b/Basis/Packages/com.basis.console/BasisLogManager.cs @@ -215,4 +215,4 @@ public static void LoadLogsFromDisk() } } } -} \ No newline at end of file +} diff --git a/Basis/Packages/com.basis.framework/Avatar/BasisAvatarFactory.cs b/Basis/Packages/com.basis.framework/Avatar/BasisAvatarFactory.cs index e8419dc76..ae898e31f 100644 --- a/Basis/Packages/com.basis.framework/Avatar/BasisAvatarFactory.cs +++ b/Basis/Packages/com.basis.framework/Avatar/BasisAvatarFactory.cs @@ -121,7 +121,7 @@ public static async Task LoadAvatarRemote(BasisRemotePlayer Player,byte Mode, Ba ChecksRequired Required = new ChecksRequired { UseContentRemoval = false, - DisableAnimatorEvents = false + DisableAnimatorEvents = false, }; var Para = new UnityEngine.ResourceManagement.ResourceProviders.InstantiationParameters(Player.transform.position, Quaternion.identity, null); (List GameObjects, AddressableGenericResource resource) = await AddressableResourceProcess.LoadAsGameObjectsAsync(BasisLoadableBundle.BasisRemoteBundleEncrypted.CombinedURL, Para, Required); diff --git a/Basis/Packages/com.basis.framework/Avatar/Eye Follow/BasisLocalEyeFollowBase.cs b/Basis/Packages/com.basis.framework/Avatar/Eye Follow/BasisLocalEyeFollowBase.cs index a8197a854..9fdc565fb 100644 --- a/Basis/Packages/com.basis.framework/Avatar/Eye Follow/BasisLocalEyeFollowBase.cs +++ b/Basis/Packages/com.basis.framework/Avatar/Eye Follow/BasisLocalEyeFollowBase.cs @@ -1,3 +1,4 @@ +using Basis.Scripts.BasisSdk.Helpers; using Basis.Scripts.BasisSdk.Players; using Basis.Scripts.Common; using Basis.Scripts.Drivers; @@ -12,7 +13,7 @@ public class BasisLocalEyeFollowBase : MonoBehaviour public quaternion leftEyeInitialRotation; public quaternion rightEyeInitialRotation; public bool HasEvents = false; - public bool Override = false; + public static bool Override = false; public float lookSpeed; // Speed of looking // Adjustable parameters public float MinlookAroundInterval = 1; // Interval between each look around in seconds @@ -32,7 +33,7 @@ public class BasisLocalEyeFollowBase : MonoBehaviour public bool HasLeftEye = false; public bool HasRightEye = false; - public bool HasHead = false; + public static bool HasHead = false; public bool LeftEyeHasGizmo; public bool RightEyeHasGizmo; public int LeftEyeGizmoIndex; @@ -46,8 +47,11 @@ public class BasisLocalEyeFollowBase : MonoBehaviour public float CurrentlookAroundInterval; public float timer; // Timer to track look-around interval public float DistanceBeforeTeleport = 30; + public static BasisLocalEyeFollowBase Instance; public void OnDestroy() { + HasHead = false; + Instance = null; if (HasEvents) { if (LinkedPlayer.IsLocal) @@ -111,6 +115,7 @@ public void Initalize(BasisAvatarDriver CAD, BasisPlayer Player) HasRendererCheckWiredUp = true; } } + Instance = this; } private void UpdateFaceVisibility(bool State) { @@ -140,14 +145,13 @@ public void UpdatGizmoUsage(bool State) } public void AfterTeleport() { - Simulate(); + if (RequiresUpdate()) + { + Simulate(); + } CenterTargetWorld = RandomizedPosition;//will be caught up } - public void LateUpdate() - { - Simulate(); - } public void OnDisable() { if (HasLeftEye && leftEyeTransform != null) @@ -161,69 +165,71 @@ public void OnDisable() } CenterTargetWorld = RandomizedPosition; wasDisabled = true; + HasHead = false; } bool wasDisabled = false; + public static bool RequiresUpdate() + { + return Override == false && HasHead; + } public void Simulate() { - if (Override == false && HasHead) - { - // Update timer using DeltaTime - timer += Time.deltaTime; + // Update timer using DeltaTime + timer += Time.deltaTime; - // Check if it's time to look around - if (timer > CurrentlookAroundInterval) - { - CurrentlookAroundInterval = UnityEngine.Random.Range(MinlookAroundInterval, MaxlookAroundInterval); - AppliedOffset = UnityEngine.Random.insideUnitSphere * MaximumLookDistance; + // Check if it's time to look around + if (timer > CurrentlookAroundInterval) + { + CurrentlookAroundInterval = UnityEngine.Random.Range(MinlookAroundInterval, MaxlookAroundInterval); + AppliedOffset = UnityEngine.Random.insideUnitSphere * MaximumLookDistance; - // Reset timer and randomize look speed - timer = 0f; - lookSpeed = UnityEngine.Random.Range(minLookSpeed, maxLookSpeed); - } + // Reset timer and randomize look speed + timer = 0f; + lookSpeed = UnityEngine.Random.Range(minLookSpeed, maxLookSpeed); + } - HeadTransform.GetPositionAndRotation(out Vector3 headPosition, out Quaternion headRotation); - float3 float3headPosition = headPosition; - quaternion QheadRotation = headRotation; - quaternion InversedHeadRotation = math.inverse(headRotation); - // Calculate the randomized target position using float3 for optimized math operations - float3 targetPosition = float3headPosition + math.mul(QheadRotation, EyeFowards) + AppliedOffset; + HeadTransform.GetPositionAndRotation(out Vector3 headPosition, out Quaternion headRotation); + float3 float3headPosition = headPosition; + quaternion QheadRotation = headRotation; + quaternion InversedHeadRotation = math.inverse(headRotation); + // Calculate the randomized target position using float3 for optimized math operations + float3 targetPosition = float3headPosition + math.mul(QheadRotation, EyeFowards) + AppliedOffset; - // Check distance for teleporting, otherwise smooth move - if (math.distance(targetPosition, CenterTargetWorld) > DistanceBeforeTeleport || wasDisabled) - { - CenterTargetWorld = targetPosition; - wasDisabled = false; - } - else - { - CenterTargetWorld = Vector3.MoveTowards(CenterTargetWorld, targetPosition, lookSpeed); - } - // Set eye rotations using optimized float3 and quaternion operations - if (HasLeftEye) - { - LeftEyeTargetWorld = CenterTargetWorld + LeftEyeInitallocalSpace.position; - leftEyeTransform.rotation = LookAtTarget(leftEyeTransform.position, LeftEyeTargetWorld, math.mul(LeftEyeInitallocalSpace.rotation, InversedHeadRotation), HeadTransform.up); - } - if (HasRightEye) - { - RightEyeTargetWorld = CenterTargetWorld + RightEyeInitallocalSpace.position; - rightEyeTransform.rotation = LookAtTarget(rightEyeTransform.position, RightEyeTargetWorld, math.mul(RightEyeInitallocalSpace.rotation, InversedHeadRotation), HeadTransform.up); - } - if (BasisGizmoManager.UseGizmos) + // Check distance for teleporting, otherwise smooth move + if (math.distance(targetPosition, CenterTargetWorld) > DistanceBeforeTeleport || wasDisabled) + { + CenterTargetWorld = targetPosition; + wasDisabled = false; + } + else + { + CenterTargetWorld = Vector3.MoveTowards(CenterTargetWorld, targetPosition, lookSpeed); + } + // Set eye rotations using optimized float3 and quaternion operations + if (HasLeftEye) + { + LeftEyeTargetWorld = CenterTargetWorld + LeftEyeInitallocalSpace.position; + leftEyeTransform.rotation = LookAtTarget(leftEyeTransform.position, LeftEyeTargetWorld, math.mul(LeftEyeInitallocalSpace.rotation, InversedHeadRotation), HeadTransform.up); + } + if (HasRightEye) + { + RightEyeTargetWorld = CenterTargetWorld + RightEyeInitallocalSpace.position; + rightEyeTransform.rotation = LookAtTarget(rightEyeTransform.position, RightEyeTargetWorld, math.mul(RightEyeInitallocalSpace.rotation, InversedHeadRotation), HeadTransform.up); + } + if (BasisGizmoManager.UseGizmos) + { + if (RightEyeHasGizmo) { - if (RightEyeHasGizmo) + if (BasisGizmoManager.UpdateSphereGizmo(RightEyeGizmoIndex, RightEyeTargetWorld) == false) { - if (BasisGizmoManager.UpdateSphereGizmo(RightEyeGizmoIndex, RightEyeTargetWorld) == false) - { - RightEyeHasGizmo = false; - } + RightEyeHasGizmo = false; } - if (LeftEyeHasGizmo) + } + if (LeftEyeHasGizmo) + { + if (BasisGizmoManager.UpdateSphereGizmo(LeftEyeGizmoIndex, LeftEyeTargetWorld) == false) { - if (BasisGizmoManager.UpdateSphereGizmo(LeftEyeGizmoIndex, LeftEyeTargetWorld) == false) - { - LeftEyeHasGizmo = false; - } + LeftEyeHasGizmo = false; } } } diff --git a/Basis/Packages/com.basis.framework/BasisEventDriver.meta b/Basis/Packages/com.basis.framework/BasisEventDriver.meta new file mode 100644 index 000000000..012576f81 --- /dev/null +++ b/Basis/Packages/com.basis.framework/BasisEventDriver.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 04ed1f6c218ec5e45ae5158b036cd3db +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Basis/Packages/com.basis.framework/BasisEventDriver/BasisEventDriver.asmdef b/Basis/Packages/com.basis.framework/BasisEventDriver/BasisEventDriver.asmdef new file mode 100644 index 000000000..5603e9022 --- /dev/null +++ b/Basis/Packages/com.basis.framework/BasisEventDriver/BasisEventDriver.asmdef @@ -0,0 +1,18 @@ +{ + "name": "BasisEventDriver", + "rootNamespace": "", + "references": [ + "GUID:c6d9b466725956a45955440904ff0491", + "GUID:8c9aa0e006f5b5347af5c5470971dfae", + "GUID:75469ad4d38634e559750d17036d5f7c" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Basis/Packages/com.basis.framework/BasisEventDriver/BasisEventDriver.asmdef.meta b/Basis/Packages/com.basis.framework/BasisEventDriver/BasisEventDriver.asmdef.meta new file mode 100644 index 000000000..ce86af804 --- /dev/null +++ b/Basis/Packages/com.basis.framework/BasisEventDriver/BasisEventDriver.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 69e646a306c85484da9e2078b7ad4dab +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Basis/Packages/com.basis.framework/BasisEventDriver/BasisEventDriver.cs b/Basis/Packages/com.basis.framework/BasisEventDriver/BasisEventDriver.cs new file mode 100644 index 000000000..8e2589a58 --- /dev/null +++ b/Basis/Packages/com.basis.framework/BasisEventDriver/BasisEventDriver.cs @@ -0,0 +1,60 @@ +using Basis.Scripts.BasisSdk.Players; +using Basis.Scripts.Device_Management; +using Basis.Scripts.Device_Management.Devices.Desktop; +using Basis.Scripts.Eye_Follow; +using Basis.Scripts.Networking; +using UnityEngine; +using UnityEngine.InputSystem; + +public class BasisEventDriver : MonoBehaviour +{ + public float updateInterval = 0.1f; // 100 milliseconds + public float timeSinceLastUpdate = 0f; + public void OnEnable() + { + Application.onBeforeRender += OnBeforeRender; + } + public void OnDisable() + { + Application.onBeforeRender -= OnBeforeRender; + } + public void Update() + { + InputSystem.Update(); + timeSinceLastUpdate += Time.deltaTime; + + if (timeSinceLastUpdate >= updateInterval) // Use '>=' to avoid small errors + { + timeSinceLastUpdate -= updateInterval; // Subtract interval instead of resetting to zero + BasisConsoleLogger.QueryLogDisplay(); + } + + if (!BasisDeviceManagement.hasPendingActions) return; + + while (BasisDeviceManagement.mainThreadActions.TryDequeue(out System.Action action)) + { + action.Invoke(); + } + + // Reset flag once all actions are executed + BasisDeviceManagement.hasPendingActions = !BasisDeviceManagement.mainThreadActions.IsEmpty; + } + + public void LateUpdate() + { + if (BasisLocalEyeFollowBase.RequiresUpdate()) + { + BasisLocalEyeFollowBase.Instance.Simulate(); + } + MicrophoneRecorder.MicrophoneUpdate(); + BasisNetworkManagement.SimulateNetwork(); + } + private void OnBeforeRender() + { + if (BasisLocalPlayer.PlayerReady) + { + BasisLocalPlayer.Instance.LocalBoneDriver.Simulate(); + } + BasisLocalInputActions.AfterAvatarChanges?.Invoke(); + } +} diff --git a/Basis/Packages/com.basis.framework/BasisEventDriver/BasisEventDriver.cs.meta b/Basis/Packages/com.basis.framework/BasisEventDriver/BasisEventDriver.cs.meta new file mode 100644 index 000000000..c6be8116a --- /dev/null +++ b/Basis/Packages/com.basis.framework/BasisEventDriver/BasisEventDriver.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 5d8279b0f691ed944a4b263282ed0bb7 \ No newline at end of file diff --git a/Basis/Packages/com.basis.framework/Bundle Management/BasisIOManagement.cs b/Basis/Packages/com.basis.framework/Bundle Management/BasisIOManagement.cs index 4cf99fca5..943eede48 100644 --- a/Basis/Packages/com.basis.framework/Bundle Management/BasisIOManagement.cs +++ b/Basis/Packages/com.basis.framework/Bundle Management/BasisIOManagement.cs @@ -15,7 +15,7 @@ public static class BasisIOManagement long LengthOfSection = BitConverter.ToInt64(ConnectorSize, 0); byte[] ConnectorBytes = await DownloadFileRange(url, null, progressCallback, cancellationToken, HeaderSize, HeaderSize + LengthOfSection - 1, true); - BasisDebug.Log("Downloaded Connector file size is " + ConnectorBytes.Length + " trying to decode with " + vp); + BasisDebug.Log("Downloaded Connector file size is " + ConnectorBytes.Length); BasisBundleConnector Connector = await BasisEncryptionToData.GenerateMetaFromBytes(vp, ConnectorBytes, progressCallback); long previousEnd = HeaderSize + LengthOfSection - 1; // Correct start position after header diff --git a/Basis/Packages/com.basis.framework/Bundle Management/BasisLoadhandler.cs b/Basis/Packages/com.basis.framework/Bundle Management/BasisLoadhandler.cs index 00c790057..fb9cd07b3 100644 --- a/Basis/Packages/com.basis.framework/Bundle Management/BasisLoadhandler.cs +++ b/Basis/Packages/com.basis.framework/Bundle Management/BasisLoadhandler.cs @@ -373,14 +373,5 @@ private static void CleanupFiles(BasisStoredEncryptedBundle bundle) { File.Delete(bundle.LocalConnectorPath); } - /* here LD - BasisEncryptionToData.GenerateBundleFromFile(, bundle.LocalConnectorPath,bundle); - - bundle.LocalConnectorPath - if (File.Exists(bundle.LocalBundleFile)) - { - File.Delete(bundle.LocalBundleFile); - } - */ } } diff --git a/Basis/Packages/com.basis.framework/Device Management/BasisDeviceManagement.cs b/Basis/Packages/com.basis.framework/Device Management/BasisDeviceManagement.cs index 8615a7ba8..9445bb8c2 100644 --- a/Basis/Packages/com.basis.framework/Device Management/BasisDeviceManagement.cs +++ b/Basis/Packages/com.basis.framework/Device Management/BasisDeviceManagement.cs @@ -48,7 +48,7 @@ public string DefaultMode() /// public static bool IsUserInDesktop() { - if(BasisDeviceManagement.Instance == null) + if (BasisDeviceManagement.Instance == null) { return false; } @@ -159,7 +159,7 @@ public bool TryFindBasisBaseTypeManagement(string name, out List mainThreadActions = new ConcurrentQueue(); - private static volatile bool hasPendingActions = false; + public static readonly ConcurrentQueue mainThreadActions = new ConcurrentQueue(); + public static volatile bool hasPendingActions = false; } } diff --git a/Basis/Packages/com.basis.framework/Device Management/BasisVisualTracker.cs b/Basis/Packages/com.basis.framework/Device Management/BasisVisualTracker.cs index 910c4ff6c..28671ffa6 100644 --- a/Basis/Packages/com.basis.framework/Device Management/BasisVisualTracker.cs +++ b/Basis/Packages/com.basis.framework/Device Management/BasisVisualTracker.cs @@ -2,7 +2,6 @@ using Basis.Scripts.Device_Management.Devices; using System; using UnityEngine; -using UnityEngine.Events; namespace Basis.Scripts.Device_Management { diff --git a/Basis/Packages/com.basis.framework/Device Management/Common/BasisDeviceNameMatcher.cs b/Basis/Packages/com.basis.framework/Device Management/Common/BasisDeviceNameMatcher.cs index 96eba9d4f..efff949b3 100644 --- a/Basis/Packages/com.basis.framework/Device Management/Common/BasisDeviceNameMatcher.cs +++ b/Basis/Packages/com.basis.framework/Device Management/Common/BasisDeviceNameMatcher.cs @@ -102,4 +102,4 @@ public override async void OnInspectorGUI() } } */ -} \ No newline at end of file +} diff --git a/Basis/Packages/com.basis.framework/Device Management/Devices/Base.meta b/Basis/Packages/com.basis.framework/Device Management/Devices/Base.meta new file mode 100644 index 000000000..8384228fe --- /dev/null +++ b/Basis/Packages/com.basis.framework/Device Management/Devices/Base.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2f87de6f818f62042a6a549f7901c860 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Basis/Packages/com.basis.framework/Device Management/Devices/BasisInput.cs b/Basis/Packages/com.basis.framework/Device Management/Devices/Base/BasisInput.cs similarity index 91% rename from Basis/Packages/com.basis.framework/Device Management/Devices/BasisInput.cs rename to Basis/Packages/com.basis.framework/Device Management/Devices/Base/BasisInput.cs index 3f19b4adf..70305f19a 100644 --- a/Basis/Packages/com.basis.framework/Device Management/Devices/BasisInput.cs +++ b/Basis/Packages/com.basis.framework/Device Management/Devices/Base/BasisInput.cs @@ -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) { @@ -141,6 +140,10 @@ public void OnDestroy() } public bool HasRaycastSupport() { + if (BasisDeviceMatchSettings == null) + { + return false; + } return hasRoleAssigned && BasisDeviceMatchSettings.HasRayCastSupport; } /// @@ -385,7 +388,7 @@ public void UpdatePlayerControl() case BasisBoneTrackedRole.Mouth: break; } - if (HasRaycastSupport()) + if (HasRaycaster) { BasisPointRaycaster.UpdateRaycast(); BasisUIRaycast.HandleUIRaycast(); @@ -396,40 +399,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(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 op = Addressables.LoadAssetAsync(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) @@ -464,6 +434,7 @@ public void HideTrackedVisual() } } public GameObject BasisPointRaycasterRef; + public bool HasRaycaster = false; public void CreateRayCaster(BasisInput BaseInput) { BasisDebug.Log("Adding RayCaster " + BaseInput.UniqueDeviceIdentifier); @@ -476,6 +447,7 @@ public void CreateRayCaster(BasisInput BaseInput) BasisUIRaycast = new BasisUIRaycast(); BasisUIRaycast.Initialize(BaseInput, BasisPointRaycaster); + HasRaycaster = true; } } } diff --git a/Basis/Packages/com.basis.framework/Device Management/Devices/BasisInput.cs.meta b/Basis/Packages/com.basis.framework/Device Management/Devices/Base/BasisInput.cs.meta similarity index 100% rename from Basis/Packages/com.basis.framework/Device Management/Devices/BasisInput.cs.meta rename to Basis/Packages/com.basis.framework/Device Management/Devices/Base/BasisInput.cs.meta diff --git a/Basis/Packages/com.basis.framework/Device Management/Devices/BasisInputEye.cs b/Basis/Packages/com.basis.framework/Device Management/Devices/Base/BasisInputEye.cs similarity index 100% rename from Basis/Packages/com.basis.framework/Device Management/Devices/BasisInputEye.cs rename to Basis/Packages/com.basis.framework/Device Management/Devices/Base/BasisInputEye.cs diff --git a/Basis/Packages/com.basis.framework/Device Management/Devices/BasisInputEye.cs.meta b/Basis/Packages/com.basis.framework/Device Management/Devices/Base/BasisInputEye.cs.meta similarity index 100% rename from Basis/Packages/com.basis.framework/Device Management/Devices/BasisInputEye.cs.meta rename to Basis/Packages/com.basis.framework/Device Management/Devices/Base/BasisInputEye.cs.meta diff --git a/Basis/Packages/com.basis.framework/Device Management/Devices/BasisInputState.cs b/Basis/Packages/com.basis.framework/Device Management/Devices/Base/BasisInputState.cs similarity index 100% rename from Basis/Packages/com.basis.framework/Device Management/Devices/BasisInputState.cs rename to Basis/Packages/com.basis.framework/Device Management/Devices/Base/BasisInputState.cs diff --git a/Basis/Packages/com.basis.framework/Device Management/Devices/BasisInputState.cs.meta b/Basis/Packages/com.basis.framework/Device Management/Devices/Base/BasisInputState.cs.meta similarity index 100% rename from Basis/Packages/com.basis.framework/Device Management/Devices/BasisInputState.cs.meta rename to Basis/Packages/com.basis.framework/Device Management/Devices/Base/BasisInputState.cs.meta diff --git a/Basis/Packages/com.basis.framework/Device Management/Devices/Desktop/BasisAvatarEyeInput.cs b/Basis/Packages/com.basis.framework/Device Management/Devices/Desktop/BasisAvatarEyeInput.cs index d2acc2c2e..0462d83de 100644 --- a/Basis/Packages/com.basis.framework/Device Management/Devices/Desktop/BasisAvatarEyeInput.cs +++ b/Basis/Packages/com.basis.framework/Device Management/Devices/Desktop/BasisAvatarEyeInput.cs @@ -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 { @@ -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(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 op = Addressables.LoadAssetAsync(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(); } } diff --git a/Basis/Packages/com.basis.framework/Device Management/Devices/Desktop/BasisLocalInputActions.cs b/Basis/Packages/com.basis.framework/Device Management/Devices/Desktop/BasisLocalInputActions.cs index ffc3a3ac8..78f74781c 100644 --- a/Basis/Packages/com.basis.framework/Device Management/Devices/Desktop/BasisLocalInputActions.cs +++ b/Basis/Packages/com.basis.framework/Device Management/Devices/Desktop/BasisLocalInputActions.cs @@ -60,18 +60,6 @@ public void OnEnable() AddCallback(); HasEvents = true; } - Application.onBeforeRender += OnBeforeRender; - } - - private void OnBeforeRender() - { - BasisLocalPlayer.Instance.LocalBoneDriver.Simulate(); - AfterAvatarChanges?.Invoke(); - } - - public void Update() - { - InputSystem.Update(); } public void SetupCamera() { @@ -91,7 +79,6 @@ public void OnDisable() RemoveCallback(); HasEvents = false; } - Application.onBeforeRender -= OnBeforeRender; } public void Initialize(BasisLocalPlayer localPlayer) { diff --git a/Basis/Packages/com.basis.framework/Device Management/Devices/OpenVR/BasisOpenVR.asmdef b/Basis/Packages/com.basis.framework/Device Management/Devices/OpenVR/BasisOpenVR.asmdef index ab3d5f126..9c537937b 100644 --- a/Basis/Packages/com.basis.framework/Device Management/Devices/OpenVR/BasisOpenVR.asmdef +++ b/Basis/Packages/com.basis.framework/Device Management/Devices/OpenVR/BasisOpenVR.asmdef @@ -11,7 +11,10 @@ "GUID:35b9c7a103b322f43805bf1744257ac7", "GUID:d8b63aba1907145bea998dd612889d6b", "GUID:45c7722710e2a37438daaacbf1cd4ad1", - "GUID:5ad71426c7096f04a9e0f40eb9cf44db" + "GUID:5ad71426c7096f04a9e0f40eb9cf44db", + "GUID:9e24947de15b9834991c9d8411ea37cf", + "GUID:75c7734b9034adc43990fe961f586496", + "GUID:84651a3751eca9349aac36a66bba901b" ], "includePlatforms": [], "excludePlatforms": [ diff --git a/Basis/Packages/com.basis.framework/Device Management/Devices/OpenVR/BasisOpenVRInput.cs b/Basis/Packages/com.basis.framework/Device Management/Devices/OpenVR/BasisOpenVRInput.cs index aaced0cae..620933ffd 100644 --- a/Basis/Packages/com.basis.framework/Device Management/Devices/OpenVR/BasisOpenVRInput.cs +++ b/Basis/Packages/com.basis.framework/Device Management/Devices/OpenVR/BasisOpenVRInput.cs @@ -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 @@ -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(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 op = Addressables.LoadAssetAsync(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); + } + } + } + } + } } } diff --git a/Basis/Packages/com.basis.framework/Device Management/Devices/OpenVR/BasisOpenVRInputController.cs b/Basis/Packages/com.basis.framework/Device Management/Devices/OpenVR/BasisOpenVRInputController.cs index f5beee0f1..d7c7b0555 100644 --- a/Basis/Packages/com.basis.framework/Device Management/Devices/OpenVR/BasisOpenVRInputController.cs +++ b/Basis/Packages/com.basis.framework/Device Management/Devices/OpenVR/BasisOpenVRInputController.cs @@ -1,9 +1,9 @@ using Basis.Scripts.BasisSdk.Players; using Basis.Scripts.Device_Management.Devices.OpenVR.Structs; using Basis.Scripts.TransformBinders.BoneControl; -using System.Threading.Tasks; using Unity.Mathematics; using UnityEngine; +using UnityEngine.AddressableAssets; using Valve.VR; namespace Basis.Scripts.Device_Management.Devices.OpenVR @@ -127,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(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 op = Addressables.LoadAssetAsync(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); + } + } + } + } + } } } diff --git a/Basis/Packages/com.basis.framework/Device Management/Devices/OpenVR/BasisOpenVRInputSpatial.cs b/Basis/Packages/com.basis.framework/Device Management/Devices/OpenVR/BasisOpenVRInputSpatial.cs index 8900a13c1..c49e26c3c 100644 --- a/Basis/Packages/com.basis.framework/Device Management/Devices/OpenVR/BasisOpenVRInputSpatial.cs +++ b/Basis/Packages/com.basis.framework/Device Management/Devices/OpenVR/BasisOpenVRInputSpatial.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using Unity.Mathematics; using UnityEngine; +using UnityEngine.AddressableAssets; using UnityEngine.SpatialTracking; using Valve.VR; @@ -58,5 +59,39 @@ public override void DoPollData() FinalRotation = LocalRawRotation; UpdatePlayerControl(); } + public override void ShowTrackedVisual() + { + if (BasisVisualTracker == null && LoadedDeviceRequest == null) + { + BasisDeviceMatchSettings Match = BasisDeviceManagement.Instance.BasisDeviceNameMatcher.GetAssociatedDeviceMatchableNames(CommonDeviceIdentifier); + if (Match.CanDisplayPhysicalTracker) + { + var op = Addressables.LoadAssetAsync(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 op = Addressables.LoadAssetAsync(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); + } + } + } + } + } } } diff --git a/Basis/Packages/com.basis.framework/Device Management/Devices/OpenXR/BasisOpenXR.asmdef b/Basis/Packages/com.basis.framework/Device Management/Devices/OpenXR/BasisOpenXR.asmdef index 57e30603b..8dfca81ec 100644 --- a/Basis/Packages/com.basis.framework/Device Management/Devices/OpenXR/BasisOpenXR.asmdef +++ b/Basis/Packages/com.basis.framework/Device Management/Devices/OpenXR/BasisOpenXR.asmdef @@ -8,7 +8,11 @@ "GUID:b4ae365a73764ee478adc74cb89832fe", "GUID:d8b63aba1907145bea998dd612889d6b", "GUID:45c7722710e2a37438daaacbf1cd4ad1", - "GUID:ed4a259f2f0ae404ca68d9463be8d538" + "GUID:ed4a259f2f0ae404ca68d9463be8d538", + "GUID:75469ad4d38634e559750d17036d5f7c", + "GUID:75c7734b9034adc43990fe961f586496", + "GUID:9e24947de15b9834991c9d8411ea37cf", + "GUID:84651a3751eca9349aac36a66bba901b" ], "includePlatforms": [], "excludePlatforms": [], diff --git a/Basis/Packages/com.basis.framework/Device Management/Devices/OpenXR/BasisOpenXRHandInput.cs b/Basis/Packages/com.basis.framework/Device Management/Devices/OpenXR/BasisOpenXRHandInput.cs new file mode 100644 index 000000000..c281a8fb5 --- /dev/null +++ b/Basis/Packages/com.basis.framework/Device Management/Devices/OpenXR/BasisOpenXRHandInput.cs @@ -0,0 +1,239 @@ +using Basis.Scripts.Device_Management.Devices; +using Basis.Scripts.TransformBinders.BoneControl; +using UnityEngine; +using static BasisBaseMuscleDriver; +using UnityEngine.InputSystem; +using Unity.Mathematics; +using Basis.Scripts.BasisSdk.Players; +using Basis.Scripts.Device_Management; +using UnityEngine.AddressableAssets; +using UnityEngine.XR; +using System.Collections.Generic; + +public class BasisOpenXRHandInput : BasisInput +{ + public FingerPose FingerCurls; + public InputActionProperty DevicePosition; + public InputActionProperty DeviceRotation; + public InputActionProperty PalmPosition; + public InputActionProperty PalmRotation; + public InputActionProperty Trigger; + public InputActionProperty Grip; + public InputActionProperty PrimaryButton; + public InputActionProperty SecondaryButton; + public InputActionProperty MenuButton; + public InputActionProperty Primary2DAxis; + public InputActionProperty Secondary2DAxis; + + public void Initialize(string UniqueID, string UnUniqueID, string subSystems, bool AssignTrackedRole, BasisBoneTrackedRole basisBoneTrackedRole) + { + InitalizeTracking(UniqueID, UnUniqueID, subSystems, AssignTrackedRole, basisBoneTrackedRole); + string devicePath = basisBoneTrackedRole == BasisBoneTrackedRole.LeftHand ? "{LeftHand}" : "{RightHand}"; + string DevicePalmPath = basisBoneTrackedRole == BasisBoneTrackedRole.LeftHand ? "{LeftHand}" : "{RightHand}"; + SetupInputActions(devicePath); + PalmPosition = new InputActionProperty(new InputAction($"{DevicePalmPath}/devicePosition", InputActionType.Value, $"{DevicePalmPath}/devicePosition", expectedControlType: "Vector3")); + PalmRotation = new InputActionProperty(new InputAction($"{DevicePalmPath}/deviceRotation", InputActionType.Value, $"{DevicePalmPath}/deviceRotation", expectedControlType: "Quaternion")); + + PalmPosition.action.Enable(); + PalmRotation.action.Enable(); + + DevicePosition = new InputActionProperty(new InputAction($"{devicePath}/devicePosition", InputActionType.Value, $"{devicePath}/devicePosition", expectedControlType: "Vector3")); + DeviceRotation = new InputActionProperty(new InputAction($"{devicePath}/deviceRotation", InputActionType.Value, $"{devicePath}/deviceRotation", expectedControlType: "Quaternion")); + + DevicePosition.action.Enable(); + DeviceRotation.action.Enable(); + } + private void SetupInputActions(string devicePath) + { + if (string.IsNullOrEmpty(devicePath)) + { + Debug.LogError("Device path is null or empty."); + return; + } + + Trigger = new InputActionProperty(new InputAction(devicePath + "/trigger", InputActionType.Value, devicePath + "/trigger", expectedControlType: "Float")); + Grip = new InputActionProperty(new InputAction(devicePath + "/grip", InputActionType.Value, devicePath + "/grip", expectedControlType: "Float")); + PrimaryButton = new InputActionProperty(new InputAction(devicePath + "/primaryButton", InputActionType.Button, devicePath + "/primaryButton", expectedControlType: "Button")); + SecondaryButton = new InputActionProperty(new InputAction(devicePath + "/secondaryButton", InputActionType.Button, devicePath + "/secondaryButton", expectedControlType: "Button")); + MenuButton = new InputActionProperty(new InputAction(devicePath + "/menuButton", InputActionType.Button, devicePath + "/menuButton", expectedControlType: "Button")); + Primary2DAxis = new InputActionProperty(new InputAction(devicePath + "/primary2DAxis", InputActionType.Value, devicePath + "/primary2DAxis", expectedControlType: "Vector2")); + Secondary2DAxis = new InputActionProperty(new InputAction(devicePath + "/secondary2DAxis", InputActionType.Value, devicePath + "/secondary2DAxis", expectedControlType: "Vector2")); + + EnableInputActions(); + } + + private void EnableInputActions() + { + EnableInputAction(PalmPosition); + EnableInputAction(PalmRotation); + EnableInputAction(Trigger); + EnableInputAction(Grip); + EnableInputAction(PrimaryButton); + EnableInputAction(SecondaryButton); + EnableInputAction(MenuButton); + EnableInputAction(Primary2DAxis); + EnableInputAction(Secondary2DAxis); + } + + private void DisableInputActions() + { + DisableInputAction(PalmPosition); + DisableInputAction(PalmRotation); + DisableInputAction(Trigger); + DisableInputAction(Grip); + DisableInputAction(PrimaryButton); + DisableInputAction(SecondaryButton); + DisableInputAction(MenuButton); + DisableInputAction(Primary2DAxis); + DisableInputAction(Secondary2DAxis); + } + + private void EnableInputAction(InputActionProperty actionProperty) => actionProperty.action?.Enable(); + private void DisableInputAction(InputActionProperty actionProperty) => actionProperty.action?.Disable(); + + public new void OnDestroy() + { + DisableInputActions(); + base.OnDestroy(); + } + public Vector3 deviceposition; + public Quaternion deviceRotation; + public override void DoPollData() + { + LocalRawPosition = PalmPosition.action.ReadValue(); + LocalRawRotation = PalmRotation.action.ReadValue(); + + deviceposition = DevicePosition.action.ReadValue(); + deviceRotation = DeviceRotation.action.ReadValue(); + + FinalPosition = BasisLocalPlayer.Instance?.CurrentHeight != null + ? LocalRawPosition * BasisLocalPlayer.Instance.CurrentHeight.EyeRatioAvatarToAvatarDefaultScale + : LocalRawPosition; + + FinalRotation = LocalRawRotation; + + InputState.Primary2DAxis = Primary2DAxis.action?.ReadValue() ?? Vector2.zero; + InputState.Secondary2DAxis = Secondary2DAxis.action?.ReadValue() ?? Vector2.zero; + + InputState.GripButton = Grip.action?.ReadValue() > 0.5f; + InputState.SecondaryTrigger = Grip.action?.ReadValue() ?? 0f; + InputState.SystemOrMenuButton = MenuButton.action?.ReadValue() > 0.5f; + InputState.PrimaryButtonGetState = PrimaryButton.action?.ReadValue() > 0.5f; + InputState.SecondaryButtonGetState = SecondaryButton.action?.ReadValue() > 0.5f; + + InputState.Trigger = Trigger.action?.ReadValue() ?? 0f; + + if (hasRoleAssigned && Control.HasTracked != BasisHasTracked.HasNoTracker) + { + // Apply position offset using math.mul for quaternion-vector multiplication + Control.IncomingData.position = FinalPosition - math.mul(FinalRotation, AvatarPositionOffset * BasisLocalPlayer.Instance.CurrentHeight.EyeRatioAvatarToAvatarDefaultScale); + + // Apply rotation offset using math.mul for quaternion multiplication + Control.IncomingData.rotation = math.mul(FinalRotation, Quaternion.Euler(AvatarRotationOffset)); + } + + CalculateFingerCurls(); + UpdatePlayerControl(); + } + + private void CalculateFingerCurls() + { + FingerCurls.ThumbPercentage = new Vector2(InputState.GripButton ? -1f : 0.7f, 0); + FingerCurls.IndexPercentage = new Vector2(BasisBaseMuscleDriver.MapValue(InputState.Trigger, 0, 1, -1f, 0.7f), 0); + FingerCurls.MiddlePercentage = new Vector2(InputState.PrimaryButtonGetState ? -1f : 0.7f, 0); + FingerCurls.RingPercentage = new Vector2(InputState.SecondaryButtonGetState ? -1f : 0.7f, 0); + FingerCurls.LittlePercentage = new Vector2(InputState.SystemOrMenuButton ? 1 - 1f : 0.7f, 0); + } + public override void ShowTrackedVisual() + { + if (BasisVisualTracker == null && LoadedDeviceRequest == null) + { + BasisDeviceMatchSettings Match = BasisDeviceManagement.Instance.BasisDeviceNameMatcher.GetAssociatedDeviceMatchableNames(CommonDeviceIdentifier); + if (Match.CanDisplayPhysicalTracker) + { + InputDeviceCharacteristics Hand = InputDeviceCharacteristics.None; + if (TryGetRole(out BasisBoneTrackedRole HandRole)) + { + switch (HandRole) + { + case BasisBoneTrackedRole.LeftHand: + Hand = InputDeviceCharacteristics.Left; + break; + case BasisBoneTrackedRole.RightHand: + Hand = InputDeviceCharacteristics.Right; + break; + default: + useFallback(); + return; + } + InputDeviceCharacteristics input = Hand | InputDeviceCharacteristics.Controller; + List inputDevices = new List(); + InputDevices.GetDevicesWithCharacteristics(input, inputDevices); + if (inputDevices.Count != 0) + { + UnityEngine.XR.InputDevice Device = inputDevices[0]; + string LoadRequest; + string HandString = Hand.ToString().ToLower(); + switch (Device.name) + { + case "Oculus Touch Controller OpenXR": + LoadRequest = $"oculus_quest_plus_controller_{HandString}"; + break; + case "Valve Index Controller OpenXR": + LoadRequest = $"valve_controller_knu_{HandString}"; + break; + case "Meta Quest Touch Pro Controller OpenXR": + LoadRequest = $"oculus_quest_pro_controller_{HandString}"; + break; + case "Meta Quest Touch Plus Controller OpenXR": + LoadRequest = $"oculus_quest_plus_controller_{HandString}"; + break; + default: + LoadRequest = $"valve_controller_knu_{HandString}"; + break; + } + + BasisDebug.Log("name was found to be "+ LoadRequest + " for device " + Device.name + " picked from " + inputDevices.Count, BasisDebug.LogTag.Device); + + var op = Addressables.LoadAssetAsync(LoadRequest); + 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 + { + useFallback(); + } + } + else + { + useFallback(); + } + } + else + { + if (UseFallbackModel()) + { + useFallback(); + } + } + } + } + public void useFallback() + { + UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle op = Addressables.LoadAssetAsync(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); + } + } +} diff --git a/Basis/Packages/com.basis.framework/Device Management/Devices/OpenXR/BasisOpenXRHandInput.cs.meta b/Basis/Packages/com.basis.framework/Device Management/Devices/OpenXR/BasisOpenXRHandInput.cs.meta new file mode 100644 index 000000000..43a1caf38 --- /dev/null +++ b/Basis/Packages/com.basis.framework/Device Management/Devices/OpenXR/BasisOpenXRHandInput.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 2fbc2b4f04c06d343ae7855b0eee7e04 \ No newline at end of file diff --git a/Basis/Packages/com.basis.framework/Device Management/Devices/OpenXR/BasisOpenXRHeadInput.cs b/Basis/Packages/com.basis.framework/Device Management/Devices/OpenXR/BasisOpenXRHeadInput.cs new file mode 100644 index 000000000..132b8061d --- /dev/null +++ b/Basis/Packages/com.basis.framework/Device Management/Devices/OpenXR/BasisOpenXRHeadInput.cs @@ -0,0 +1,103 @@ +using Basis.Scripts.BasisSdk.Players; +using Basis.Scripts.Device_Management; +using Basis.Scripts.Device_Management.Devices; +using Basis.Scripts.Device_Management.Devices.OpenXR; +using Basis.Scripts.TransformBinders.BoneControl; +using Unity.Mathematics; +using UnityEngine; +using UnityEngine.AddressableAssets; +using UnityEngine.InputSystem; + +public class BasisOpenXRHeadInput : BasisInput +{ + public BasisOpenXRInputEye BasisOpenXRInputEye; + public BasisVirtualSpineDriver BasisVirtualSpine = new BasisVirtualSpineDriver(); + public InputActionProperty Position; + public InputActionProperty Rotation; + + public void Initialize(string UniqueID, string UnUniqueID, string subSystems, bool AssignTrackedRole) + { + InitalizeTracking(UniqueID, UnUniqueID, subSystems, AssignTrackedRole, BasisBoneTrackedRole.CenterEye); + + Position = new InputActionProperty(new InputAction("/centerEyePosition", InputActionType.Value, "/centerEyePosition", expectedControlType: "Vector3")); + Rotation = new InputActionProperty(new InputAction("/centerEyeRotation", InputActionType.Value, "/centerEyeRotation", expectedControlType: "Quaternion")); + + Position.action.Enable(); + Rotation.action.Enable(); + + BasisOpenXRInputEye = gameObject.AddComponent(); + BasisOpenXRInputEye.Initalize(); + BasisVirtualSpine.Initialize(); + } + + private void DisableInputActions() + { + Position.action?.Disable(); + Rotation.action?.Disable(); + } + + public new void OnDestroy() + { + DisableInputActions(); + BasisVirtualSpine.DeInitialize(); + BasisOpenXRInputEye?.Shutdown(); + base.OnDestroy(); + } + + public override void DoPollData() + { + if (Position.action != null) LocalRawPosition = Position.action.ReadValue(); + if (Rotation.action != null) LocalRawRotation = Rotation.action.ReadValue(); + + FinalPosition = BasisLocalPlayer.Instance?.CurrentHeight != null + ? LocalRawPosition * BasisLocalPlayer.Instance.CurrentHeight.EyeRatioAvatarToAvatarDefaultScale + : LocalRawPosition; + + FinalRotation = LocalRawRotation; + + if (hasRoleAssigned && Control.HasTracked != BasisHasTracked.HasNoTracker) + { + // Apply position offset using math.mul for quaternion-vector multiplication + Control.IncomingData.position = FinalPosition - math.mul(FinalRotation, AvatarPositionOffset * BasisLocalPlayer.Instance.CurrentHeight.EyeRatioAvatarToAvatarDefaultScale); + + // Apply rotation offset using math.mul for quaternion multiplication + Control.IncomingData.rotation = FinalRotation; + } + + UpdatePlayerControl(); + } + public override void ShowTrackedVisual() + { + if (BasisVisualTracker == null && LoadedDeviceRequest == null) + { + BasisDeviceMatchSettings Match = BasisDeviceManagement.Instance.BasisDeviceNameMatcher.GetAssociatedDeviceMatchableNames(CommonDeviceIdentifier); + if (Match.CanDisplayPhysicalTracker) + { + var op = Addressables.LoadAssetAsync(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 op = Addressables.LoadAssetAsync(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); + } + } + } + } + } +} diff --git a/Basis/Packages/com.basis.framework/Device Management/Devices/OpenXR/BasisOpenXRHeadInput.cs.meta b/Basis/Packages/com.basis.framework/Device Management/Devices/OpenXR/BasisOpenXRHeadInput.cs.meta new file mode 100644 index 000000000..4c29fbd5c --- /dev/null +++ b/Basis/Packages/com.basis.framework/Device Management/Devices/OpenXR/BasisOpenXRHeadInput.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 8f47da5cfd0c8014fa7977639b76f74a \ No newline at end of file diff --git a/Basis/Packages/com.basis.framework/Device Management/Devices/OpenXR/BasisOpenXRInput.cs b/Basis/Packages/com.basis.framework/Device Management/Devices/OpenXR/BasisOpenXRInput.cs deleted file mode 100644 index 93cd7c441..000000000 --- a/Basis/Packages/com.basis.framework/Device Management/Devices/OpenXR/BasisOpenXRInput.cs +++ /dev/null @@ -1,147 +0,0 @@ -using Basis.Scripts.BasisSdk.Players; -using Basis.Scripts.TransformBinders.BoneControl; -using System.Threading.Tasks; -using Unity.Mathematics; -using UnityEngine; -using static BasisBaseMuscleDriver; - -namespace Basis.Scripts.Device_Management.Devices.OpenXR -{ - [DefaultExecutionOrder(15001)] - public class BasisOpenXRInput : BasisInput - { - public UnityEngine.XR.InputDevice Device; - public FingerPose FingerCurls; - public BasisOpenXRInputEye BasisOpenXRInputEye; - public BasisVirtualSpineDriver BasisVirtualSpine = new BasisVirtualSpineDriver(); - public void Initialize(UnityEngine.XR.InputDevice device, string UniqueID, string UnUniqueID, string subSystems, bool AssignTrackedRole, BasisBoneTrackedRole basisBoneTrackedRole) - { - Device = device; - InitalizeTracking(UniqueID, UnUniqueID, subSystems, AssignTrackedRole, basisBoneTrackedRole); - if (basisBoneTrackedRole == BasisBoneTrackedRole.CenterEye) - { - BasisOpenXRInputEye = this.gameObject.AddComponent(); - BasisOpenXRInputEye.Initalize(); - BasisVirtualSpine.Initialize(); - } - } - public new void OnDestroy() - { - BasisVirtualSpine.DeInitialize(); - if (BasisOpenXRInputEye != null) - { - BasisOpenXRInputEye.Shutdown(); - } - base.OnDestroy(); - } - public override void DoPollData() - { - if (Device.isValid) - { - // Rotation and Position - if (Device.TryGetFeatureValue(UnityEngine.XR.CommonUsages.deviceRotation, out Quaternion Rotation)) - { - LocalRawRotation = Rotation; - if (hasRoleAssigned && Control.HasTracked != BasisHasTracked.HasNoTracker) - { - Control.IncomingData.rotation = math.mul(LocalRawRotation, Quaternion.Euler(AvatarRotationOffset)); - } - } - - if (Device.TryGetFeatureValue(UnityEngine.XR.CommonUsages.devicePosition, out Vector3 Position)) - { - LocalRawPosition = Position; - if (hasRoleAssigned && Control.HasTracked != BasisHasTracked.HasNoTracker) - { - // Apply the inverse rotation to position offset - Control.IncomingData.position = LocalRawPosition - math.mul(LocalRawRotation, AvatarPositionOffset * BasisLocalPlayer.Instance.CurrentHeight.EyeRatioAvatarToAvatarDefaultScale); - } - } - - FinalPosition = LocalRawPosition * BasisLocalPlayer.Instance.CurrentHeight.EyeRatioAvatarToAvatarDefaultScale; - FinalRotation = LocalRawRotation; - - // Input States - if (Device.TryGetFeatureValue(UnityEngine.XR.CommonUsages.primary2DAxis, out Vector2 Primary2DAxis)) - { - InputState.Primary2DAxis = Primary2DAxis; - } - if (Device.TryGetFeatureValue(UnityEngine.XR.CommonUsages.secondary2DAxis, out Vector2 secondary2DAxis)) - { - InputState.Secondary2DAxis = secondary2DAxis; - } - if (Device.TryGetFeatureValue(UnityEngine.XR.CommonUsages.gripButton, out bool gripButton)) - { - InputState.GripButton = gripButton; - } - if (Device.TryGetFeatureValue(UnityEngine.XR.CommonUsages.menuButton, out bool menuButton)) - { - InputState.SystemOrMenuButton = menuButton; - } - if (Device.TryGetFeatureValue(UnityEngine.XR.CommonUsages.primaryButton, out bool primaryButtonGetState)) - { - InputState.PrimaryButtonGetState = primaryButtonGetState; - } - if (Device.TryGetFeatureValue(UnityEngine.XR.CommonUsages.secondaryButton, out bool secondaryButtonGetState)) - { - InputState.SecondaryButtonGetState = secondaryButtonGetState; - } - if (Device.TryGetFeatureValue(UnityEngine.XR.CommonUsages.trigger, out float Trigger)) - { - InputState.Trigger = Trigger; - } - if (Device.TryGetFeatureValue(UnityEngine.XR.CommonUsages.secondary2DAxisClick, out bool secondary2DAxisClick)) - { - InputState.Secondary2DAxisClick = secondary2DAxisClick; - } - if (Device.TryGetFeatureValue(UnityEngine.XR.CommonUsages.primary2DAxisClick, out bool primary2DAxisClick)) - { - InputState.Primary2DAxisClick = primary2DAxisClick; - } - - if (Device.TryGetFeatureValue(UnityEngine.XR.CommonUsages.grip, out float SecondaryTrigger)) - { - InputState.SecondaryTrigger = SecondaryTrigger; - } - /* - * target.TrackPad = this.TrackPad; - target.TrackPadTouched = this.TrackPadTouched; - target.System = this.System; - target.JoyStickClick = this.JoyStickClick; - */ - - // Calculate Finger Curls - CalculateFingerCurls(); - - // Apply Animations - if (TryGetRole(out BasisBoneTrackedRole BBTR)) - { - switch (BBTR) - { - case BasisBoneTrackedRole.LeftHand: - BasisLocalPlayer.Instance.AvatarDriver.BasisMuscleDriver.LeftFinger = FingerCurls; - break; - case BasisBoneTrackedRole.RightHand: - BasisLocalPlayer.Instance.AvatarDriver.BasisMuscleDriver.RightFinger = FingerCurls; - break; - case BasisBoneTrackedRole.CenterEye: - BasisOpenXRInputEye = this.gameObject.AddComponent(); - BasisOpenXRInputEye.Simulate(); - break; - } - } - - UpdatePlayerControl(); - } - } - - private void CalculateFingerCurls() - { - FingerCurls.ThumbPercentage = new Vector2(InputState.GripButton ? -1f : 0.7f, 0);//thumb - FingerCurls.IndexPercentage = new Vector2(BasisBaseMuscleDriver.MapValue(InputState.Trigger, 0, 1, -1f, 0.7f), 0);// Index finger curl - FingerCurls.MiddlePercentage = new Vector2(InputState.PrimaryButtonGetState ? -1f : 0.7f, 0);// Middle finger curl - FingerCurls.RingPercentage = new Vector2(InputState.SecondaryButtonGetState ? -1f : 0.7f, 0); // Ring finger curl - FingerCurls.LittlePercentage = new Vector2(InputState.SystemOrMenuButton ? 1 - 1f : 0.7f, 0); // Pinky finger curl - } - } -} diff --git a/Basis/Packages/com.basis.framework/Device Management/Devices/OpenXR/BasisOpenXRInput.cs.meta b/Basis/Packages/com.basis.framework/Device Management/Devices/OpenXR/BasisOpenXRInput.cs.meta deleted file mode 100644 index 917ca7aa5..000000000 --- a/Basis/Packages/com.basis.framework/Device Management/Devices/OpenXR/BasisOpenXRInput.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 774563ec4e423b243b9bf1ed1bdb0592 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Basis/Packages/com.basis.framework/Device Management/Devices/OpenXR/BasisOpenXRManagement.cs b/Basis/Packages/com.basis.framework/Device Management/Devices/OpenXR/BasisOpenXRManagement.cs index b9bb27ab5..4b8f31920 100644 --- a/Basis/Packages/com.basis.framework/Device Management/Devices/OpenXR/BasisOpenXRManagement.cs +++ b/Basis/Packages/com.basis.framework/Device Management/Devices/OpenXR/BasisOpenXRManagement.cs @@ -2,125 +2,56 @@ using Basis.Scripts.TransformBinders.BoneControl; using System; using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using UnityEngine; -using UnityEngine.XR; - -namespace Basis.Scripts.Device_Management.Devices.OpenXR +namespace Basis.Scripts.Device_Management.Devices.UnityInputSystem { [Serializable] public class BasisOpenXRManagement : BasisBaseTypeManagement { - public List inputDevices = new List(); - public Dictionary TypicalDevices = new Dictionary(); - public bool HasEvents = false; - private void OnDeviceConnected(InputDevice device) - { - UpdateDeviceList(); - } - - private void OnDeviceDisconnected(InputDevice device) - { - UpdateDeviceList(); - } - - private void UpdateDeviceList() + List controls = new List(); + private void CreatePhysicalHandTracker(string device, string uniqueID, BasisBoneTrackedRole Role) { - InputDevices.GetDevices(inputDevices); - - foreach (var device in inputDevices) - { - if (device.characteristics.HasFlag(InputDeviceCharacteristics.TrackingReference)) - continue; - - if (device != null) - { - string id = GenerateID(device); - if (!TypicalDevices.ContainsKey(id)) - { - CreatePhysicalTrackedDevice(device, id); - TypicalDevices[id] = device; - } - } - } - - var keysToRemove = new List(); - foreach (var kvp in TypicalDevices) + var gameObject = new GameObject(uniqueID) { - if (!inputDevices.Contains(kvp.Value)) + transform = { - keysToRemove.Add(kvp.Key); + parent = BasisLocalPlayer.Instance.LocalBoneDriver.transform } - } - - foreach (var key in keysToRemove) - { - DestroyPhysicalTrackedDevice(key); - TypicalDevices.Remove(key); - } - } - - private string GenerateID(InputDevice device) - { - return $"{device.name}|{device.serialNumber}|{device.manufacturer}|{(int)device.characteristics}"; + }; + BasisOpenXRHandInput basisXRInput = gameObject.AddComponent(); + basisXRInput.ClassName = nameof(BasisOpenXRHandInput); + basisXRInput.Initialize(uniqueID, device, nameof(BasisOpenXRManagement), true, Role); + BasisDeviceManagement.Instance.TryAdd(basisXRInput); + controls.Add(basisXRInput); } - - private void CreatePhysicalTrackedDevice(InputDevice device, string uniqueID) + private void CreatePhysicalHeadTracker(string device, string uniqueID) { var gameObject = new GameObject(uniqueID) { transform = - { - parent = BasisLocalPlayer.Instance.LocalBoneDriver.transform - } + { + parent = BasisLocalPlayer.Instance.LocalBoneDriver.transform + } }; - var basisXRInput = gameObject.AddComponent(); - basisXRInput.ClassName = nameof(BasisOpenXRInput); - bool state = GetControllerOrHMD(device, out BasisBoneTrackedRole BasisBoneTrackedRole); - basisXRInput.Initialize(device, uniqueID, device.name + BasisBoneTrackedRole.ToString(), nameof(BasisOpenXRManagement), state, BasisBoneTrackedRole); + BasisOpenXRHeadInput basisXRInput = gameObject.AddComponent(); + basisXRInput.ClassName = nameof(BasisOpenXRHeadInput); + basisXRInput.Initialize(uniqueID, device, nameof(BasisOpenXRManagement), true); BasisDeviceManagement.Instance.TryAdd(basisXRInput); - } - private bool GetControllerOrHMD(InputDevice device, out BasisBoneTrackedRole BasisBoneTrackedRole) - { - BasisBoneTrackedRole = BasisBoneTrackedRole.CenterEye; - if (device.characteristics == Characteristics.hmd) - { - BasisBoneTrackedRole = BasisBoneTrackedRole.CenterEye; - return true; - } - else if (device.characteristics == Characteristics.leftController || device.characteristics == Characteristics.leftTrackedHand) - { - BasisBoneTrackedRole = BasisBoneTrackedRole.LeftHand; - return true; - } - else if (device.characteristics == Characteristics.rightController || device.characteristics == Characteristics.rightTrackedHand) - { - BasisBoneTrackedRole = BasisBoneTrackedRole.RightHand; - return true; - } - return false; + controls.Add(basisXRInput); } public void DestroyPhysicalTrackedDevice(string id) { - TypicalDevices.Remove(id); - BasisDeviceManagement.Instance.RemoveDevicesFrom("BasisOpenXRManagement", id); + BasisDeviceManagement.Instance.RemoveDevicesFrom(nameof(BasisOpenXRManagement), id); } public override void StopSDK() { - BasisDebug.Log("Stopping BasisOpenXRManagement"); - List Devices = TypicalDevices.Keys.ToList(); - foreach (string device in Devices) + BasisDebug.Log("Stopping " + nameof(BasisOpenXRManagement)); + foreach (var device in controls) { - DestroyPhysicalTrackedDevice(device); - } - if (HasEvents) - { - InputDevices.deviceConnected -= OnDeviceConnected; - InputDevices.deviceDisconnected -= OnDeviceDisconnected; - HasEvents = false; + DestroyPhysicalTrackedDevice(device.UniqueDeviceIdentifier); } + controls.Clear(); } public override void BeginLoadSDK() @@ -129,59 +60,16 @@ public override void BeginLoadSDK() public override void StartSDK() { - BasisDeviceManagement.Instance.SetCameraRenderState(true); - BasisDebug.Log("Starting BasisOpenXRManagement"); - if (HasEvents == false) - { - InputDevices.deviceConnected += OnDeviceConnected; - InputDevices.deviceDisconnected += OnDeviceDisconnected; - HasEvents = true; - } - UpdateDeviceList(); + BasisDeviceManagement.Instance.SetCameraRenderState(true); + BasisDebug.Log("Starting " + nameof(BasisOpenXRManagement)); + CreatePhysicalHeadTracker("Head OPENXR", "Head OPENXR"); + CreatePhysicalHandTracker("Left Hand OPENXR", "Left Hand OPENXR", BasisBoneTrackedRole.LeftHand); + CreatePhysicalHandTracker("Right Hand OPENXR", "Right Hand OPENXR", BasisBoneTrackedRole.RightHand); } public override string Type() { return "OpenXRLoader"; } - - public static class Characteristics - { - /// - /// HMD characteristics. - /// | - /// - public static InputDeviceCharacteristics hmd => InputDeviceCharacteristics.HeadMounted | InputDeviceCharacteristics.TrackedDevice; - - /// - /// Eye gaze characteristics. - /// | | - /// - public static InputDeviceCharacteristics eyeGaze => InputDeviceCharacteristics.HeadMounted | InputDeviceCharacteristics.EyeTracking | InputDeviceCharacteristics.TrackedDevice; - - /// - /// Left controller characteristics. - /// | | | - /// - public static InputDeviceCharacteristics leftController => InputDeviceCharacteristics.HeldInHand | InputDeviceCharacteristics.TrackedDevice | InputDeviceCharacteristics.Controller | InputDeviceCharacteristics.Left; - - /// - /// Right controller characteristics. - /// | | | - /// - public static InputDeviceCharacteristics rightController => InputDeviceCharacteristics.HeldInHand | InputDeviceCharacteristics.TrackedDevice | InputDeviceCharacteristics.Controller | InputDeviceCharacteristics.Right; - - /// - /// Left tracked hand characteristics. - /// | | - /// - public static InputDeviceCharacteristics leftTrackedHand => InputDeviceCharacteristics.HandTracking | InputDeviceCharacteristics.TrackedDevice | InputDeviceCharacteristics.Left; - - /// - /// Right tracked hand characteristics. - /// | | - /// - public static InputDeviceCharacteristics rightTrackedHand => InputDeviceCharacteristics.HandTracking | InputDeviceCharacteristics.TrackedDevice | InputDeviceCharacteristics.Right; - } } } diff --git a/Basis/Packages/com.basis.framework/Device Management/Devices/Simulation/BasisInputXRSimulate.cs b/Basis/Packages/com.basis.framework/Device Management/Devices/Simulation/BasisInputXRSimulate.cs index 525d3b841..28df4749b 100644 --- a/Basis/Packages/com.basis.framework/Device Management/Devices/Simulation/BasisInputXRSimulate.cs +++ b/Basis/Packages/com.basis.framework/Device Management/Devices/Simulation/BasisInputXRSimulate.cs @@ -2,6 +2,7 @@ using Basis.Scripts.TransformBinders.BoneControl; using Unity.Mathematics; using UnityEngine; +using UnityEngine.AddressableAssets; namespace Basis.Scripts.Device_Management.Devices.Simulation { @@ -53,5 +54,40 @@ public override void DoPollData() } base.OnDestroy(); } + + public override void ShowTrackedVisual() + { + if (BasisVisualTracker == null && LoadedDeviceRequest == null) + { + BasisDeviceMatchSettings Match = BasisDeviceManagement.Instance.BasisDeviceNameMatcher.GetAssociatedDeviceMatchableNames(CommonDeviceIdentifier); + if (Match.CanDisplayPhysicalTracker) + { + var op = Addressables.LoadAssetAsync(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 op = Addressables.LoadAssetAsync(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); + } + } + } + } + } } } diff --git a/Basis/Packages/com.basis.framework/Drivers/BasisAvatarDriver.cs b/Basis/Packages/com.basis.framework/Drivers/BasisAvatarDriver.cs index 2a702a57a..cbc1d1f36 100644 --- a/Basis/Packages/com.basis.framework/Drivers/BasisAvatarDriver.cs +++ b/Basis/Packages/com.basis.framework/Drivers/BasisAvatarDriver.cs @@ -5,6 +5,7 @@ using Basis.Scripts.Device_Management; using Basis.Scripts.TransformBinders.BoneControl; using System; +using System.Collections.Generic; using Unity.Mathematics; using UnityEngine; using UnityEngine.AddressableAssets; @@ -35,6 +36,40 @@ public float ActiveAvatarEyeHeight() public BasisPlayer Player; public bool CurrentlyTposing = false; public bool HasEvents = false; + public List ActiveMatrixOverrides = new List(); + public void TryActiveMatrixOverride(int InstanceID) + { + if (ActiveMatrixOverrides.Contains(InstanceID) == false) + { + ActiveMatrixOverrides.Add(InstanceID); + SetAllMatrixRecalculation(true); + } + } + public void RemoveActiveMatrixOverride(int InstanceID) + { + if (ActiveMatrixOverrides.Remove(InstanceID)) + { + if (ActiveMatrixOverrides.Count == 0) + { + SetAllMatrixRecalculation(false); + } + } + } + public void SetMatrixOverride() + { +#if UNITY_EDITOR + SetAllMatrixRecalculation(true); +#else + if (ActiveMatrixOverrides.Count != 0) + { + SetAllMatrixRecalculation(true); + } + else + { + SetAllMatrixRecalculation(false); + } +#endif + } public void Calibration(BasisAvatar Avatar) { FindSkinnedMeshRenders(); @@ -302,31 +337,24 @@ public void SetAndCreateLock(BaseBoneDriver BaseBoneDriver, BasisBoneTrackedRole BaseBoneDriver.CreateRotationalLock(AssignedToAddToBone, LockToBone, PositionLerpAmount, QuaternionLerpAmount); } } + public int SkinnedMeshRendererLength; public void FindSkinnedMeshRenders() { SkinnedMeshRenderer = Player.BasisAvatar.Animator.GetComponentsInChildren(true); + SkinnedMeshRendererLength = SkinnedMeshRenderer.Length; } public void SetAllMatrixRecalculation(bool State) { - foreach (SkinnedMeshRenderer Render in SkinnedMeshRenderer) + for (int Index = 0; Index < SkinnedMeshRendererLength; Index++) { + SkinnedMeshRenderer Render = SkinnedMeshRenderer[Index]; Render.forceMatrixRecalculationPerRender = State; } - } - public void SetHeadMatrixRecalculation(bool State) - { - if (Player.BasisAvatar.FaceBlinkMesh != null) - { - Player.BasisAvatar.FaceBlinkMesh.forceMatrixRecalculationPerRender = State; - } - if (Player.BasisAvatar.FaceVisemeMesh != null) - { - Player.BasisAvatar.FaceVisemeMesh.forceMatrixRecalculationPerRender = State; - } + BasisDebug.Log("Matrix Recal State set to " + State); } public void updateWhenOffscreen(bool State) { - for (int Index = 0; Index < SkinnedMeshRenderer.Length; Index++) + for (int Index = 0; Index < SkinnedMeshRendererLength; Index++) { SkinnedMeshRenderer Render = SkinnedMeshRenderer[Index]; Render.updateWhenOffscreen = State; diff --git a/Basis/Packages/com.basis.framework/Drivers/BasisLocalAvatarDriver.cs b/Basis/Packages/com.basis.framework/Drivers/BasisLocalAvatarDriver.cs index b9c75da9e..d53372431 100644 --- a/Basis/Packages/com.basis.framework/Drivers/BasisLocalAvatarDriver.cs +++ b/Basis/Packages/com.basis.framework/Drivers/BasisLocalAvatarDriver.cs @@ -108,7 +108,7 @@ public void InitialLocalCalibration(BasisLocalPlayer Player) BasisLocalEyeFollowDriver = BasisHelpers.GetOrAddComponent(Player.BasisAvatar.gameObject); BasisLocalEyeFollowDriver.Initalize(this,Player); HeadScaledDown = Vector3.zero; - SetAllMatrixRecalculation(true); + SetMatrixOverride(); updateWhenOffscreen(true); if (References.Hashead) { @@ -149,6 +149,10 @@ public void InitialLocalCalibration(BasisLocalPlayer Player) Player.BasisAvatar.transform.SetLocalPositionAndRotation(-Hips.TposeLocal.position, Quaternion.identity); CalibrateOffsets(); BuildBuilder(); + if(BasisLocalCameraDriver.Instance != null) + { + BasisLocalCameraDriver.Instance.IsNormalHead = true; + } } public void OnDestroy() { diff --git a/Basis/Packages/com.basis.framework/Drivers/BasisLocalCameraDriver.cs b/Basis/Packages/com.basis.framework/Drivers/BasisLocalCameraDriver.cs index d760f1140..088b36163 100644 --- a/Basis/Packages/com.basis.framework/Drivers/BasisLocalCameraDriver.cs +++ b/Basis/Packages/com.basis.framework/Drivers/BasisLocalCameraDriver.cs @@ -7,10 +7,11 @@ using UnityEngine; using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; -using UnityEngine.UI; using UnityEngine.XR; using Vector3 = UnityEngine.Vector3; using BattlePhaze.SettingsManager; +using System.Collections.Generic; +using System; namespace Basis.Scripts.Drivers { @@ -90,6 +91,7 @@ public void OnEnable() SpriteRendererIcon.gameObject.SetActive(true); SettingsManager.Instance.Initalize(true); } + public void MicrophoneTransmitting() { SpriteRendererIcon.color = UnMutedMutedIconColorActive; @@ -290,6 +292,7 @@ public void OnDisable() HasEvents = false; } } + public void BeginCameraRendering(ScriptableRenderContext context, Camera Camera) { if (LocalPlayer.HasAvatarDriver && LocalPlayer.AvatarDriver.References.Hashead) @@ -306,7 +309,7 @@ public void BeginCameraRendering(ScriptableRenderContext context, Camera Camera) else { Vector3 worldPoint = Camera.ViewportToWorldPoint(DesktopMicrophoneViewportPosition); - Vector3 localPos = this.transform.InverseTransformPoint(worldPoint);//asume this transform is also camera position + Vector3 localPos = transform.InverseTransformPoint(worldPoint);//asume this transform is also camera position CanvasTransform.localPosition = localPos; } } @@ -316,18 +319,21 @@ public void BeginCameraRendering(ScriptableRenderContext context, Camera Camera) } } } + public bool IsNormalHead; public void ScaleHeadToNormal() { - if (LocalPlayer.AvatarDriver.References.head.localScale != LocalPlayer.AvatarDriver.HeadScale) + if (IsNormalHead == false) { LocalPlayer.AvatarDriver.References.head.localScale = LocalPlayer.AvatarDriver.HeadScale; + IsNormalHead = true; } } public void ScaleheadToZero() { - if (LocalPlayer.AvatarDriver.References.head.localScale != LocalPlayer.AvatarDriver.HeadScaledDown) + if (IsNormalHead) { LocalPlayer.AvatarDriver.References.head.localScale = LocalPlayer.AvatarDriver.HeadScaledDown; + IsNormalHead = false; } } // Function to calculate the position diff --git a/Basis/Packages/com.basis.framework/Microphone/MicrophoneRecorder.cs b/Basis/Packages/com.basis.framework/Microphone/MicrophoneRecorder.cs index 71d5126d4..4de511305 100644 --- a/Basis/Packages/com.basis.framework/Microphone/MicrophoneRecorder.cs +++ b/Basis/Packages/com.basis.framework/Microphone/MicrophoneRecorder.cs @@ -7,21 +7,21 @@ using Unity.Jobs; public partial class MicrophoneRecorder : MicrophoneRecorderBase { - private int head = 0; - private int bufferLength; - public bool HasEvents = false; - public int PacketSize; - public bool UseDenoiser = false; + private static int head = 0; + private static int bufferLength; + public static bool HasEvents = false; + public static int PacketSize; + public static bool UseDenoiser = false; public static Action OnPausedAction; - private bool MicrophoneIsStarted = false; - private Thread processingThread; - public bool isRunning = true; - private ManualResetEvent processingEvent = new ManualResetEvent(false); - private object processingLock = new object(); - private int position; - private NativeArray PBA; - private LogarithmicVolumeAdjustmentJob VAJ; - private JobHandle handle; + private static bool MicrophoneIsStarted = false; + private static Thread processingThread; + public static bool isRunning = true; + private static ManualResetEvent processingEvent = new ManualResetEvent(false); + private static object processingLock = new object(); + private static int position; + private static NativeArray PBA; + private static LogarithmicVolumeAdjustmentJob VAJ; + private static JobHandle handle; public bool TryInitialize() { if (!IsInitialize) @@ -177,12 +177,12 @@ private bool IsPaused OnPausedAction?.Invoke(isPaused); } } - private bool ScheduleMainHasAudio; - private bool ScheduleMainHasSilence; + private static bool ScheduleMainHasAudio; + private static bool ScheduleMainHasSilence; public static Action MainThreadOnHasAudio; public static Action MainThreadOnHasSilence; // Event triggered when silence is detected - private readonly object _lock = new object(); - public void LateUpdate() + private static readonly object _lock = new object(); + public static void MicrophoneUpdate() { if (MicrophoneIsStarted) { diff --git a/Basis/Packages/com.basis.framework/Microphone/MicrophoneRecorderBase.cs b/Basis/Packages/com.basis.framework/Microphone/MicrophoneRecorderBase.cs index c7767762e..7e99b1eca 100644 --- a/Basis/Packages/com.basis.framework/Microphone/MicrophoneRecorderBase.cs +++ b/Basis/Packages/com.basis.framework/Microphone/MicrophoneRecorderBase.cs @@ -4,21 +4,21 @@ public abstract class MicrophoneRecorderBase : MonoBehaviour { public static Action OnHasAudio; public static Action OnHasSilence; // Event triggered when silence is detected - public AudioClip clip; - public bool IsInitialize = false; - public string MicrophoneDevice = null; - public int ProcessBufferLength; - public float Volume = 1; // Volume adjustment factor, default to 1 (no adjustment) + public static AudioClip clip; + public static bool IsInitialize = false; + public static string MicrophoneDevice = null; + public static int ProcessBufferLength; + public static float Volume = 1; // Volume adjustment factor, default to 1 (no adjustment) [HideInInspector] - public float[] microphoneBufferArray; + public static float[] microphoneBufferArray; [HideInInspector] - public float[] processBufferArray; + public static float[] processBufferArray; [HideInInspector] - public float[] rmsValues; - public int rmsIndex = 0; - public float averageRms; + public static float[] rmsValues; + public static int rmsIndex = 0; + public static float averageRms; #if !UNITY_ANDROID - public RNNoise.NET.Denoiser Denoiser = new RNNoise.NET.Denoiser(); + public static RNNoise.NET.Denoiser Denoiser = new RNNoise.NET.Denoiser(); #endif public void OnDestroy() { diff --git a/Basis/Packages/com.basis.framework/Networking/BasisNetworkManagement.cs b/Basis/Packages/com.basis.framework/Networking/BasisNetworkManagement.cs index e4f6a6254..697cc6de2 100644 --- a/Basis/Packages/com.basis.framework/Networking/BasisNetworkManagement.cs +++ b/Basis/Packages/com.basis.framework/Networking/BasisNetworkManagement.cs @@ -71,6 +71,7 @@ public class BasisNetworkManagement : MonoBehaviour /// allows a local host to be the server /// public BasisNetworkServerRunner BasisNetworkServerRunner = null; + public static bool NetworkRunning = false; public static bool AddPlayer(BasisNetworkPlayer NetPlayer) { if (Instance != null) @@ -127,6 +128,7 @@ public void OnEnable() BasisScene.Ready += SetupSceneEvents; this.transform.SetPositionAndRotation(Vector3.zero, Quaternion.identity); OnEnableInstanceCreate?.Invoke(); + NetworkRunning = true; } private void LogErrorOutput(string obj) { @@ -146,6 +148,7 @@ public void OnDestroy() Shutdown(); BasisAvatarBufferPool.Clear(); BasisNetworkClient.Disconnect(); + NetworkRunning = false; } public async void Shutdown() { @@ -196,20 +199,23 @@ public void Update() } } } - public void LateUpdate() + public static void SimulateNetwork() { - double TimeAsDouble = Time.timeAsDouble; - float deltaTime = Time.deltaTime; - if (float.IsNaN(deltaTime)) + if (NetworkRunning) { - return; - } - // Complete tasks and apply results - for (int Index = 0; Index < ReceiverCount; Index++) - { - if (ReceiverArray[Index] != null) + double TimeAsDouble = Time.timeAsDouble; + float deltaTime = Time.deltaTime; + if (float.IsNaN(deltaTime)) { - ReceiverArray[Index].Apply(TimeAsDouble, deltaTime); + return; + } + // Complete tasks and apply results + for (int Index = 0; Index < ReceiverCount; Index++) + { + if (ReceiverArray[Index] != null) + { + ReceiverArray[Index].Apply(TimeAsDouble, deltaTime); + } } } } @@ -317,7 +323,7 @@ await Task.Run(() => } catch (Exception ex) { - BasisDebug.LogError($"Error setting up the local player: {ex.Message}"); + BasisDebug.LogError($"Error setting up the local player: {ex.Message} {ex.StackTrace}"); } }), null); }); diff --git a/Basis/Packages/com.basis.framework/Networking/Compression/BasisOpusSettings.cs b/Basis/Packages/com.basis.framework/Networking/Compression/BasisOpusSettings.cs index 7f53d2740..27f0e439f 100644 --- a/Basis/Packages/com.basis.framework/Networking/Compression/BasisOpusSettings.cs +++ b/Basis/Packages/com.basis.framework/Networking/Compression/BasisOpusSettings.cs @@ -6,22 +6,22 @@ public static class LocalOpusSettings public static int RecordingFullLength = 1; public static OpusPredefinedValues OpusApplication = OpusPredefinedValues.OPUS_APPLICATION_AUDIO; public static float DesiredDurationInSeconds = 0.02f; - public static int MicrophoneSampleRate { get; private set; } = 48000; + public static int MicrophoneSampleRate = 48000; /// /// we only ever need one channel /// - public static int Channels { get; private set; } = 1; + public static int Channels = 1; public static float noiseGateThreshold = 0.01f; public static float silenceThreshold = 0.0007f; public static int rmsWindowSize = 10; public static void SetDeviceAudioConfig(int maxFreq) { - MicrophoneSampleRate = maxFreq; + // MicrophoneSampleRate = maxFreq; } public static int SampleRate() { - return (int) Mathf.CeilToInt(DesiredDurationInSeconds * MicrophoneSampleRate); + return Mathf.CeilToInt(DesiredDurationInSeconds * MicrophoneSampleRate); } public static float[] CalculateProcessBuffer() { diff --git a/Basis/Packages/com.basis.framework/Networking/Recievers/BasisNetworkReceiver.cs b/Basis/Packages/com.basis.framework/Networking/Recievers/BasisNetworkReceiver.cs index 744f501f6..8115c62c0 100644 --- a/Basis/Packages/com.basis.framework/Networking/Recievers/BasisNetworkReceiver.cs +++ b/Basis/Packages/com.basis.framework/Networking/Recievers/BasisNetworkReceiver.cs @@ -87,9 +87,9 @@ public void Compute(double TimeAsDouble) { TargetVectors[0] = Last.Position; // Target position at index 0 OuputVectors[0] = First.Position; // Position at index 0 - - OuputVectors[1] = First.Scale; // Scale at index 1 - TargetVectors[1] = Last.Scale; // Target scale at index 1 + Vector3 Scale = Player.BasisAvatar.Animator.transform.localScale; + OuputVectors[1] = Scale; // Scale at index 1 + TargetVectors[1] = Scale; // Target scale at index 1 } catch (Exception ex) { diff --git a/Basis/Packages/com.basis.framework/Networking/Transmitters/BasisAudioTransmission.cs b/Basis/Packages/com.basis.framework/Networking/Transmitters/BasisAudioTransmission.cs index 94069248a..00ebb51af 100644 --- a/Basis/Packages/com.basis.framework/Networking/Transmitters/BasisAudioTransmission.cs +++ b/Basis/Packages/com.basis.framework/Networking/Transmitters/BasisAudioTransmission.cs @@ -47,9 +47,9 @@ public void OnEnable(BasisNetworkPlayer networkedPlayer) MicrophoneRecorder.OnHasSilence += SendSilenceOverNetwork; HasEvents = true; // Ensure the output buffer is properly initialized and matches the packet size - if (Recorder.PacketSize != AudioSegmentData.TotalLength) + if (MicrophoneRecorder.PacketSize != AudioSegmentData.TotalLength) { - AudioSegmentData = new AudioSegmentDataMessage(new byte[Recorder.PacketSize]); + AudioSegmentData = new AudioSegmentDataMessage(new byte[MicrophoneRecorder.PacketSize]); } } } @@ -78,12 +78,12 @@ public void OnAudioReady() if (NetworkedPlayer.HasReasonToSendAudio) { // UnityEngine.BasisDebug.Log("Sending out Audio"); - if (Recorder.PacketSize != AudioSegmentData.TotalLength) + if (MicrophoneRecorder.PacketSize != AudioSegmentData.TotalLength) { - AudioSegmentData = new AudioSegmentDataMessage(new byte[Recorder.PacketSize]); + AudioSegmentData = new AudioSegmentDataMessage(new byte[MicrophoneRecorder.PacketSize]); } // Encode the audio data from the microphone recorder's buffer - AudioSegmentData.LengthUsed = encoder.Encode(Recorder.processBufferArray, LocalOpusSettings.SampleRate(), AudioSegmentData.buffer, AudioSegmentData.TotalLength); + AudioSegmentData.LengthUsed = encoder.Encode(MicrophoneRecorder.processBufferArray, LocalOpusSettings.SampleRate(), AudioSegmentData.buffer, AudioSegmentData.TotalLength); NetDataWriter writer = new NetDataWriter(); AudioSegmentData.Serialize(writer); BasisNetworkProfiler.AudioSegmentDataMessageCounter.Sample(AudioSegmentData.LengthUsed); diff --git a/Basis/Packages/com.basis.framework/Players/BasisLocalPlayer.cs b/Basis/Packages/com.basis.framework/Players/BasisLocalPlayer.cs index 5b095202e..ef4f2782b 100644 --- a/Basis/Packages/com.basis.framework/Players/BasisLocalPlayer.cs +++ b/Basis/Packages/com.basis.framework/Players/BasisLocalPlayer.cs @@ -74,7 +74,6 @@ public async Task LocalInitialize() { Instance = this; } - Instance = this; MicrophoneRecorder.OnPausedAction += OnPausedEvent; OnLocalPlayerCreated?.Invoke(); IsLocal = true; diff --git a/Basis/Packages/com.basis.framework/SettingsManagerModules/URP Only Modules/SMModuleAntialiasingURP.cs b/Basis/Packages/com.basis.framework/SettingsManagerModules/URP Only Modules/SMModuleAntialiasingURP.cs index 3133916de..efd1c9ce7 100644 --- a/Basis/Packages/com.basis.framework/SettingsManagerModules/URP Only Modules/SMModuleAntialiasingURP.cs +++ b/Basis/Packages/com.basis.framework/SettingsManagerModules/URP Only Modules/SMModuleAntialiasingURP.cs @@ -29,9 +29,9 @@ public void SetMSAAQuality(string Quality) return; } #if UNITY_ANDROID - Asset.msaaSampleCount = LowmsaaSampleCount; - Camera.allowMSAA = true; - Data.antialiasing = AntialiasingMode.SubpixelMorphologicalAntiAliasing; + Asset.msaaSampleCount = 0; + Camera.allowMSAA = false; + Data.antialiasing = AntialiasingMode.None; Data.antialiasingQuality = AntialiasingQuality.Low; #else switch (Quality) diff --git a/Basis/Packages/com.basis.framework/UI/BasisUIRaycastProcess.cs b/Basis/Packages/com.basis.framework/UI/BasisUIRaycastProcess.cs index 5bbb7e55d..b4f5603fd 100644 --- a/Basis/Packages/com.basis.framework/UI/BasisUIRaycastProcess.cs +++ b/Basis/Packages/com.basis.framework/UI/BasisUIRaycastProcess.cs @@ -46,7 +46,7 @@ public void Simulate() for (int Index = 0; Index < DevicesCount; Index++) { BasisInput input = Inputs[Index]; - if (input.HasRaycastSupport() && input.BasisUIRaycast.WasCorrectLayer) + if (input.HasRaycaster && input.BasisUIRaycast.WasCorrectLayer) { EffectiveMouseAction |= input.BasisUIRaycast.CurrentEventData.WasLastDown == false && input.InputState.Trigger == 1; if (input.BasisUIRaycast.HadRaycastUITarget) @@ -70,7 +70,7 @@ public void Simulate() for (int Index = 0; Index < DevicesCount; Index++) { BasisInput input = Inputs[Index]; - if (input.HasRaycastSupport() && input.BasisUIRaycast.WasCorrectLayer) + if (input.HasRaycaster && input.BasisUIRaycast.WasCorrectLayer) { SendUpdateEventToSelectedObject(input.BasisUIRaycast.CurrentEventData); //needed if you want to use the keyboard } diff --git a/Basis/Packages/com.basis.framework/UI/NamePlate/RemoteNamePlateDriver.cs b/Basis/Packages/com.basis.framework/UI/NamePlate/RemoteNamePlateDriver.cs index 2e39d3c23..539ca83b0 100644 --- a/Basis/Packages/com.basis.framework/UI/NamePlate/RemoteNamePlateDriver.cs +++ b/Basis/Packages/com.basis.framework/UI/NamePlate/RemoteNamePlateDriver.cs @@ -97,9 +97,9 @@ private void ResizeArray(int newSize) public void LateUpdate() { Vector3 Position = BasisLocalCameraDriver.Position; - for (int i = 0; i < count; i++) + for (int Index = 0; Index < count; Index++) { - BasisNamePlate NamePlate = basisRemotePlayers[i]; + BasisNamePlate NamePlate = basisRemotePlayers[Index]; NamePlate.cachedDirection = NamePlate.HipTarget.OutgoingWorldData.position; NamePlate.cachedDirection.y += NamePlate.MouthTarget.TposeLocal.position.y / NamePlate.YHeightMultiplier; NamePlate.dirToCamera = Position - NamePlate.cachedDirection; diff --git a/Basis/Packages/com.basis.sdk/Prefabs/Boot/BootManager.prefab b/Basis/Packages/com.basis.sdk/Prefabs/Boot/BootManager.prefab index 10a67b66f..5e8449d10 100644 --- a/Basis/Packages/com.basis.sdk/Prefabs/Boot/BootManager.prefab +++ b/Basis/Packages/com.basis.sdk/Prefabs/Boot/BootManager.prefab @@ -2018,7 +2018,7 @@ MonoBehaviour: PlatFormDefaultState: - Platform: 11 GraphicsVendor: 0 - SetString: 0 + SetString: 0.5 ExcludeFromThesePlatforms: [] MasterQualityState: 0 ParseController: 1 @@ -2663,6 +2663,7 @@ GameObject: - component: {fileID: -3061024371983229343} - component: {fileID: 8683862064975223899} - component: {fileID: 8988764245560573337} + - component: {fileID: 6910429841152494025} m_Layer: 0 m_Name: BootManager m_TagString: Untagged @@ -2760,7 +2761,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: e66a79eb227d0d448870a4e95dc14eeb, type: 3} m_Name: m_EditorClassIdentifier: - HasEvents: 0 --- !u!114 &508802122937325065 MonoBehaviour: m_ObjectHideFlags: 0 @@ -2857,3 +2857,17 @@ MonoBehaviour: BasisBundleGenerated: [] UseAddressablesToLoadScene: 0 UseSceneProvidedHere: 0 +--- !u!114 &6910429841152494025 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9135220577826176361} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5d8279b0f691ed944a4b263282ed0bb7, type: 3} + m_Name: + m_EditorClassIdentifier: + updateInterval: 0.1 + timeSinceLastUpdate: 0 diff --git a/Basis/Packages/com.basis.sdk/Settings/Basis Devices Matcher.asset b/Basis/Packages/com.basis.sdk/Settings/Basis Devices Matcher.asset index 56c709c9a..cc8a29779 100644 --- a/Basis/Packages/com.basis.sdk/Settings/Basis Devices Matcher.asset +++ b/Basis/Packages/com.basis.sdk/Settings/Basis Devices Matcher.asset @@ -139,36 +139,6 @@ MonoBehaviour: HasTrackedRole: 1 TrackedRole: 0 HasInteractVisual: 1 - - DeviceID: Index Controller OpenXRLeftHand - VersionNumber: 1 - matchableDeviceIds: - - Index Controller OpenXRLeftHand - HasRayCastSupport: 1 - CanDisplayPhysicalTracker: 1 - HasRayCastVisual: 1 - HasRayCastRedical: 1 - PositionRayCastOffset: {x: 0, y: 0, z: 0} - RotationRaycastOffset: {x: 0, y: 0, z: 0} - AvatarPositionOffset: {x: 0, y: 0, z: 0} - AvatarRotationOffset: {x: 0, y: 0, z: 0} - HasTrackedRole: 1 - TrackedRole: 18 - HasInteractVisual: 1 - - DeviceID: Index Controller OpenXRRightHand - VersionNumber: 1 - matchableDeviceIds: - - Index Controller OpenXRRightHand - HasRayCastSupport: 1 - CanDisplayPhysicalTracker: 1 - HasRayCastVisual: 1 - HasRayCastRedical: 1 - PositionRayCastOffset: {x: 0, y: 0, z: 0} - RotationRaycastOffset: {x: 0, y: 0, z: 0} - AvatarPositionOffset: {x: 0, y: 0, z: 0} - AvatarRotationOffset: {x: 0, y: 0, z: 0} - HasTrackedRole: 1 - TrackedRole: 19 - HasInteractVisual: 1 - DeviceID: generic_hmd VersionNumber: 1 matchableDeviceIds: @@ -304,10 +274,10 @@ MonoBehaviour: HasTrackedRole: 1 TrackedRole: 19 HasInteractVisual: 1 - - DeviceID: Head Tracking - OpenXRCenterEye + - DeviceID: Head OPENXR VersionNumber: 1 matchableDeviceIds: - - Head Tracking - OpenXRCenterEye + - Head OPENXR HasRayCastSupport: 0 CanDisplayPhysicalTracker: 0 HasRayCastVisual: 0 @@ -319,14 +289,104 @@ MonoBehaviour: HasTrackedRole: 1 TrackedRole: 0 HasInteractVisual: 1 - - DeviceID: Hand Interaction OpenXRCenterEye + - DeviceID: Left Hand OPENXR VersionNumber: 1 matchableDeviceIds: - - Hand Interaction OpenXRCenterEye - HasRayCastSupport: 0 + - Left Hand OPENXR + HasRayCastSupport: 1 + CanDisplayPhysicalTracker: 1 + HasRayCastVisual: 1 + HasRayCastRedical: 1 + PositionRayCastOffset: {x: 0, y: 0, z: 0} + RotationRaycastOffset: {x: 0, y: 0, z: 0} + AvatarPositionOffset: {x: 0, y: 0, z: 0} + AvatarRotationOffset: {x: -60, y: 30, z: 0} + HasTrackedRole: 1 + TrackedRole: 18 + HasInteractVisual: 1 + - DeviceID: Right Hand OPENXR + VersionNumber: 1 + matchableDeviceIds: + - Right Hand OPENXR + HasRayCastSupport: 1 + CanDisplayPhysicalTracker: 1 + HasRayCastVisual: 1 + HasRayCastRedical: 1 + PositionRayCastOffset: {x: 0, y: 0, z: 0} + RotationRaycastOffset: {x: 0, y: 0, z: 0} + AvatarPositionOffset: {x: 0, y: 0, z: 0} + AvatarRotationOffset: {x: -60, y: -30, z: 0} + HasTrackedRole: 1 + TrackedRole: 19 + HasInteractVisual: 1 + - DeviceID: '{standable}/rendermodels/Estimated/sfbePelvis' + VersionNumber: 1 + matchableDeviceIds: + - '{standable}/rendermodels/Estimated/sfbePelvis' + HasRayCastSupport: 1 CanDisplayPhysicalTracker: 0 - HasRayCastVisual: 0 - HasRayCastRedical: 0 + HasRayCastVisual: 1 + HasRayCastRedical: 1 + PositionRayCastOffset: {x: 0, y: 0, z: 0} + RotationRaycastOffset: {x: 0, y: 0, z: 0} + AvatarPositionOffset: {x: 0, y: 0, z: 0} + AvatarRotationOffset: {x: 0, y: 0, z: 0} + HasTrackedRole: 0 + TrackedRole: 0 + HasInteractVisual: 1 + - DeviceID: '{standable}/rendermodels/Estimated/sfbeFoot' + VersionNumber: 1 + matchableDeviceIds: + - '{standable}/rendermodels/Estimated/sfbeFoot' + HasRayCastSupport: 1 + CanDisplayPhysicalTracker: 0 + HasRayCastVisual: 1 + HasRayCastRedical: 1 + PositionRayCastOffset: {x: 0, y: 0, z: 0} + RotationRaycastOffset: {x: 0, y: 0, z: 0} + AvatarPositionOffset: {x: 0, y: 0, z: 0} + AvatarRotationOffset: {x: 0, y: 0, z: 0} + HasTrackedRole: 0 + TrackedRole: 0 + HasInteractVisual: 1 + - DeviceID: '{standable}/rendermodels/Estimated/sfbeChest' + VersionNumber: 1 + matchableDeviceIds: + - '{standable}/rendermodels/Estimated/sfbeChest' + HasRayCastSupport: 1 + CanDisplayPhysicalTracker: 0 + HasRayCastVisual: 1 + HasRayCastRedical: 1 + PositionRayCastOffset: {x: 0, y: 0, z: 0} + RotationRaycastOffset: {x: 0, y: 0, z: 0} + AvatarPositionOffset: {x: 0, y: 0, z: 0} + AvatarRotationOffset: {x: 0, y: 0, z: 0} + HasTrackedRole: 0 + TrackedRole: 0 + HasInteractVisual: 1 + - DeviceID: '{standable}/rendermodels/Estimated/sfbeElbow' + VersionNumber: 1 + matchableDeviceIds: + - '{standable}/rendermodels/Estimated/sfbeElbow' + HasRayCastSupport: 1 + CanDisplayPhysicalTracker: 0 + HasRayCastVisual: 1 + HasRayCastRedical: 1 + PositionRayCastOffset: {x: 0, y: 0, z: 0} + RotationRaycastOffset: {x: 0, y: 0, z: 0} + AvatarPositionOffset: {x: 0, y: 0, z: 0} + AvatarRotationOffset: {x: 0, y: 0, z: 0} + HasTrackedRole: 0 + TrackedRole: 0 + HasInteractVisual: 1 + - DeviceID: '{standable}/rendermodels/Estimated/sfbeKnee' + VersionNumber: 1 + matchableDeviceIds: + - '{standable}/rendermodels/Estimated/sfbeKnee' + HasRayCastSupport: 1 + CanDisplayPhysicalTracker: 0 + HasRayCastVisual: 1 + HasRayCastRedical: 1 PositionRayCastOffset: {x: 0, y: 0, z: 0} RotationRaycastOffset: {x: 0, y: 0, z: 0} AvatarPositionOffset: {x: 0, y: 0, z: 0} @@ -461,36 +521,6 @@ MonoBehaviour: HasTrackedRole: 1 TrackedRole: 0 HasInteractVisual: 1 - - DeviceID: Index Controller OpenXRLeftHand - VersionNumber: 1 - matchableDeviceIds: - - Index Controller OpenXRLeftHand - HasRayCastSupport: 1 - CanDisplayPhysicalTracker: 1 - HasRayCastVisual: 1 - HasRayCastRedical: 1 - PositionRayCastOffset: {x: 0, y: 0, z: 0} - RotationRaycastOffset: {x: 0, y: 0, z: 0} - AvatarPositionOffset: {x: 0, y: 0, z: 0} - AvatarRotationOffset: {x: 0, y: 0, z: 0} - HasTrackedRole: 1 - TrackedRole: 18 - HasInteractVisual: 1 - - DeviceID: Index Controller OpenXRRightHand - VersionNumber: 1 - matchableDeviceIds: - - Index Controller OpenXRRightHand - HasRayCastSupport: 1 - CanDisplayPhysicalTracker: 1 - HasRayCastVisual: 1 - HasRayCastRedical: 1 - PositionRayCastOffset: {x: 0, y: 0, z: 0} - RotationRaycastOffset: {x: 0, y: 0, z: 0} - AvatarPositionOffset: {x: 0, y: 0, z: 0} - AvatarRotationOffset: {x: 0, y: 0, z: 0} - HasTrackedRole: 1 - TrackedRole: 19 - HasInteractVisual: 1 - DeviceID: generic_hmd VersionNumber: 1 matchableDeviceIds: @@ -626,10 +656,10 @@ MonoBehaviour: HasTrackedRole: 1 TrackedRole: 19 HasInteractVisual: 1 - - DeviceID: Head Tracking - OpenXRCenterEye + - DeviceID: Head OPENXR VersionNumber: 1 matchableDeviceIds: - - Head Tracking - OpenXRCenterEye + - Head OPENXR HasRayCastSupport: 0 CanDisplayPhysicalTracker: 0 HasRayCastVisual: 0 @@ -641,14 +671,104 @@ MonoBehaviour: HasTrackedRole: 1 TrackedRole: 0 HasInteractVisual: 1 - - DeviceID: Hand Interaction OpenXRCenterEye + - DeviceID: Left Hand OPENXR VersionNumber: 1 matchableDeviceIds: - - Hand Interaction OpenXRCenterEye - HasRayCastSupport: 0 + - Left Hand OPENXR + HasRayCastSupport: 1 + CanDisplayPhysicalTracker: 1 + HasRayCastVisual: 1 + HasRayCastRedical: 1 + PositionRayCastOffset: {x: 0, y: 0, z: 0} + RotationRaycastOffset: {x: 0, y: 0, z: 0} + AvatarPositionOffset: {x: 0, y: 0, z: 0} + AvatarRotationOffset: {x: -60, y: 30, z: 0} + HasTrackedRole: 1 + TrackedRole: 18 + HasInteractVisual: 1 + - DeviceID: Right Hand OPENXR + VersionNumber: 1 + matchableDeviceIds: + - Right Hand OPENXR + HasRayCastSupport: 1 + CanDisplayPhysicalTracker: 1 + HasRayCastVisual: 1 + HasRayCastRedical: 1 + PositionRayCastOffset: {x: 0, y: 0, z: 0} + RotationRaycastOffset: {x: 0, y: 0, z: 0} + AvatarPositionOffset: {x: 0, y: 0, z: 0} + AvatarRotationOffset: {x: -60, y: -30, z: 0} + HasTrackedRole: 1 + TrackedRole: 19 + HasInteractVisual: 1 + - DeviceID: '{standable}/rendermodels/Estimated/sfbePelvis' + VersionNumber: 1 + matchableDeviceIds: + - '{standable}/rendermodels/Estimated/sfbePelvis' + HasRayCastSupport: 1 CanDisplayPhysicalTracker: 0 - HasRayCastVisual: 0 - HasRayCastRedical: 0 + HasRayCastVisual: 1 + HasRayCastRedical: 1 + PositionRayCastOffset: {x: 0, y: 0, z: 0} + RotationRaycastOffset: {x: 0, y: 0, z: 0} + AvatarPositionOffset: {x: 0, y: 0, z: 0} + AvatarRotationOffset: {x: 0, y: 0, z: 0} + HasTrackedRole: 0 + TrackedRole: 0 + HasInteractVisual: 1 + - DeviceID: '{standable}/rendermodels/Estimated/sfbeFoot' + VersionNumber: 1 + matchableDeviceIds: + - '{standable}/rendermodels/Estimated/sfbeFoot' + HasRayCastSupport: 1 + CanDisplayPhysicalTracker: 0 + HasRayCastVisual: 1 + HasRayCastRedical: 1 + PositionRayCastOffset: {x: 0, y: 0, z: 0} + RotationRaycastOffset: {x: 0, y: 0, z: 0} + AvatarPositionOffset: {x: 0, y: 0, z: 0} + AvatarRotationOffset: {x: 0, y: 0, z: 0} + HasTrackedRole: 0 + TrackedRole: 0 + HasInteractVisual: 1 + - DeviceID: '{standable}/rendermodels/Estimated/sfbeChest' + VersionNumber: 1 + matchableDeviceIds: + - '{standable}/rendermodels/Estimated/sfbeChest' + HasRayCastSupport: 1 + CanDisplayPhysicalTracker: 0 + HasRayCastVisual: 1 + HasRayCastRedical: 1 + PositionRayCastOffset: {x: 0, y: 0, z: 0} + RotationRaycastOffset: {x: 0, y: 0, z: 0} + AvatarPositionOffset: {x: 0, y: 0, z: 0} + AvatarRotationOffset: {x: 0, y: 0, z: 0} + HasTrackedRole: 0 + TrackedRole: 0 + HasInteractVisual: 1 + - DeviceID: '{standable}/rendermodels/Estimated/sfbeElbow' + VersionNumber: 1 + matchableDeviceIds: + - '{standable}/rendermodels/Estimated/sfbeElbow' + HasRayCastSupport: 1 + CanDisplayPhysicalTracker: 0 + HasRayCastVisual: 1 + HasRayCastRedical: 1 + PositionRayCastOffset: {x: 0, y: 0, z: 0} + RotationRaycastOffset: {x: 0, y: 0, z: 0} + AvatarPositionOffset: {x: 0, y: 0, z: 0} + AvatarRotationOffset: {x: 0, y: 0, z: 0} + HasTrackedRole: 0 + TrackedRole: 0 + HasInteractVisual: 1 + - DeviceID: '{standable}/rendermodels/Estimated/sfbeKnee' + VersionNumber: 1 + matchableDeviceIds: + - '{standable}/rendermodels/Estimated/sfbeKnee' + HasRayCastSupport: 1 + CanDisplayPhysicalTracker: 0 + HasRayCastVisual: 1 + HasRayCastRedical: 1 PositionRayCastOffset: {x: 0, y: 0, z: 0} RotationRaycastOffset: {x: 0, y: 0, z: 0} AvatarPositionOffset: {x: 0, y: 0, z: 0} diff --git a/Basis/Packages/com.basis.tests/Interactable/PlayerInteract.cs b/Basis/Packages/com.basis.tests/Interactable/PlayerInteract.cs index f6c2b8b99..1a97251b6 100644 --- a/Basis/Packages/com.basis.tests/Interactable/PlayerInteract.cs +++ b/Basis/Packages/com.basis.tests/Interactable/PlayerInteract.cs @@ -89,7 +89,7 @@ private void OnDestroy() private void OnInputChanged(BasisInput Input) { // TODO: need a different config value for can interact/pickup/grab. Mainly input action/trigger values - if (Input.HasRaycastSupport()) + if (Input.HasRaycaster) { AddInput(Input); } @@ -376,7 +376,7 @@ private void RemoveInput(string uid) } else { - BasisDebug.LogError("Interact Inputs has multiple inputs of the same UID. Please report this bug."); + BasisDebug.LogError($"Interact Inputs has multiple inputs of the same UID {uid}. Please report this bug."); } } diff --git a/Basis/Packages/com.basis.tests/Mirror/BasisSDKMirror.cs b/Basis/Packages/com.basis.tests/Mirror/BasisSDKMirror.cs index 27ddd7fcb..f4ca7ed6e 100644 --- a/Basis/Packages/com.basis.tests/Mirror/BasisSDKMirror.cs +++ b/Basis/Packages/com.basis.tests/Mirror/BasisSDKMirror.cs @@ -8,6 +8,7 @@ using Basis.Scripts.BasisSdk.Helpers; using Basis.Scripts.Device_Management; using System.Collections; +using Basis.Scripts.BasisSdk.Players; public class BasisSDKMirror : MonoBehaviour { public Renderer Renderer;//only renders when this is visible @@ -41,7 +42,8 @@ public class BasisSDKMirror : MonoBehaviour public bool allowXRRendering = true; public bool RenderPostProcessing = false; - + public bool OcclusionCulling = false; + public bool renderShadows = false; [SerializeField] private LayerMask ReflectingLayers; public void Awake() @@ -67,6 +69,7 @@ public void Awake() BasisMeshRendererCheck = BasisHelpers.GetOrAddComponent(this.Renderer.gameObject); BasisMeshRendererCheck.Check += VisibilityFlag; } + private int InstanceID; public void OnEnable() { if (BasisLocalCameraDriver.HasInstance) @@ -75,6 +78,7 @@ public void OnEnable() } BasisLocalCameraDriver.InstanceExists += Initalize; RenderPipeline.beginCameraRendering += UpdateCamera; + InstanceID = gameObject.GetInstanceID(); } public IEnumerator Start() @@ -108,6 +112,7 @@ public void OnDisable() } BasisLocalCameraDriver.InstanceExists -= Initalize; RenderPipeline.beginCameraRendering -= UpdateCamera; + BasisLocalPlayer.Instance.AvatarDriver.RemoveActiveMatrixOverride(InstanceID); } private void BootModeChanged(string obj) @@ -141,7 +146,9 @@ private void UpdateCamera(ScriptableRenderContext SRC, Camera camera) if (IsCameraAble(camera)) { OnCamerasRenderering?.Invoke(); + BasisLocalCameraDriver.Instance.ScaleHeadToNormal(); + BasisLocalPlayer.Instance.AvatarDriver.TryActiveMatrixOverride(InstanceID); ThisPosition = Renderer.transform.position; projectionMatrix = camera.projectionMatrix; normal = Renderer.transform.TransformDirection(projectionDirection); @@ -235,7 +242,7 @@ private void CreatePortalCamera(Camera camera, StereoscopicEye eye, ref Camera p { name = "__MirrorReflection" + eye.ToString() + GetInstanceID(), isPowerOfTwo = true, - antiAliasing = Antialising + antiAliasing = Antialising, }; string Property = "_ReflectionTex" + eye.ToString(); Renderer.material = MirrorsMaterial; @@ -260,10 +267,12 @@ private void CreateNewCamera(Camera currentCamera, out Camera newCamera) newCamera.orthographicSize = currentCamera.orthographicSize; newCamera.depth = 2; newCamera.cullingMask = ReflectingLayers.value; + newCamera.useOcclusionCulling = OcclusionCulling; if (newCamera.TryGetComponent(out UniversalAdditionalCameraData CameraData)) { CameraData.allowXRRendering = allowXRRendering; CameraData.renderPostProcessing = RenderPostProcessing; + CameraData.renderShadows = renderShadows; } } private void VisibilityFlag(bool IsVisible) diff --git a/Basis/Packages/manifest.json b/Basis/Packages/manifest.json index 120fcb661..629d211e2 100644 --- a/Basis/Packages/manifest.json +++ b/Basis/Packages/manifest.json @@ -6,7 +6,7 @@ "com.unity.animation.rigging": "1.3.0", "com.unity.ide.rider": "3.0.31", "com.unity.ide.visualstudio": "2.0.22", - "com.unity.inputsystem": "1.13.0", + "com.unity.inputsystem": "1.13.1", "com.unity.memoryprofiler": "1.1.5", "com.unity.profiling.core": "1.0.2", "com.unity.render-pipelines.universal": "17.0.4", @@ -14,7 +14,7 @@ "com.unity.toolchain.win-x86_64-linux-x86_64": "2.0.10", "com.unity.visualeffectgraph": "17.0.4", "com.unity.xr.management": "4.5.0", - "com.unity.xr.openxr": "1.14.0", + "com.unity.xr.openxr": "1.14.1", "com.valvesoftware.unity.openvr": "file:com.valvesoftware.unity.openvr-1.2.1.tgz", "com.xiph.rnnoise": "https://github.com/BasisVR/RNNoise.Net.git", "org.basisvr.base128": "file:org.basisvr.base128-1.2.2.tgz", diff --git a/Basis/Packages/packages-lock.json b/Basis/Packages/packages-lock.json index 466a88ad5..d974dda74 100644 --- a/Basis/Packages/packages-lock.json +++ b/Basis/Packages/packages-lock.json @@ -210,7 +210,7 @@ "url": "https://packages.unity.com" }, "com.unity.inputsystem": { - "version": "1.13.0", + "version": "1.13.1", "depth": 0, "source": "registry", "dependencies": { @@ -427,7 +427,7 @@ "url": "https://packages.unity.com" }, "com.unity.xr.openxr": { - "version": "1.14.0", + "version": "1.14.1", "depth": 0, "source": "registry", "dependencies": { diff --git a/Basis/ProjectSettings/ProjectSettings.asset b/Basis/ProjectSettings/ProjectSettings.asset index a813c2d1b..9de40c7dc 100644 --- a/Basis/ProjectSettings/ProjectSettings.asset +++ b/Basis/ProjectSettings/ProjectSettings.asset @@ -155,8 +155,8 @@ PlayerSettings: isWsaHolographicRemotingEnabled: 0 enableFrameTimingStats: 0 enableOpenGLProfilerGPURecorders: 1 - allowHDRDisplaySupport: 1 - useHDRDisplay: 1 + allowHDRDisplaySupport: 0 + useHDRDisplay: 0 hdrBitDepth: 1 m_ColorGamuts: 00000000 targetPixelDensity: 30 @@ -174,9 +174,9 @@ PlayerSettings: iPhone: 0 tvOS: 0 overrideDefaultApplicationIdentifier: 0 - AndroidBundleVersionCode: 10 - AndroidMinSdkVersion: 32 - AndroidTargetSdkVersion: 0 + AndroidBundleVersionCode: 21 + AndroidMinSdkVersion: 29 + AndroidTargetSdkVersion: 32 AndroidPreferredInstallLocation: 0 aotOptions: stripEngineCode: 1 @@ -268,8 +268,9 @@ PlayerSettings: AndroidTargetArchitectures: 2 AndroidSplashScreenScale: 0 androidSplashScreen: {fileID: 0} - AndroidKeystoreName: - AndroidKeyaliasName: + AndroidKeystoreName: C:/Users/doola/OneDrive/Documents/Github/Basis Foundation/Basis + Keys/BasisQuest.keystore + AndroidKeyaliasName: basis AndroidEnableArmv9SecurityFeatures: 0 AndroidEnableArm64MTE: 0 AndroidBuildApkPerCpuArchitecture: 0 @@ -278,7 +279,7 @@ PlayerSettings: AndroidEnableTango: 0 androidEnableBanner: 1 androidUseLowAccuracyLocation: 0 - androidUseCustomKeystore: 0 + androidUseCustomKeystore: 1 m_AndroidBanners: - width: 320 height: 180 diff --git a/Basis/ProjectSettings/ProjectVersion.txt b/Basis/ProjectSettings/ProjectVersion.txt index a1aff48dd..041b8c875 100644 --- a/Basis/ProjectSettings/ProjectVersion.txt +++ b/Basis/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 6000.0.40f1 -m_EditorVersionWithRevision: 6000.0.40f1 (157d81624ddf) +m_EditorVersion: 6000.0.41f1 +m_EditorVersionWithRevision: 6000.0.41f1 (46e447368a18) diff --git a/Basis/ProjectSettings/QualitySettings.asset b/Basis/ProjectSettings/QualitySettings.asset index 61ef6ba9f..5c1f0d0d1 100644 --- a/Basis/ProjectSettings/QualitySettings.asset +++ b/Basis/ProjectSettings/QualitySettings.asset @@ -75,7 +75,7 @@ QualitySettings: globalTextureMipmapLimit: 0 textureMipmapLimitSettings: [] anisotropicTextures: 1 - antiAliasing: 2 + antiAliasing: 0 softParticles: 1 softVegetation: 1 realtimeReflectionProbes: 1 diff --git a/Basis/RuntimeActionBindings.json b/Basis/RuntimeActionBindings.json index e69de29bb..37487d1d3 100644 --- a/Basis/RuntimeActionBindings.json +++ b/Basis/RuntimeActionBindings.json @@ -0,0 +1 @@ +{"InputActionDefinitions": [],"InputActionSets": []} \ No newline at end of file diff --git a/README.md b/README.md index 9044b6c90..285fd5124 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ We are actively working on Basis. If you like what you see please consider contr ## How you can Contribute -After a half-year of development, we have only recently put Basis on github, which that means while everything is operational, we still have to work on fixing plenty of bugs. +After a half-year of development, we have only recently put Basis on github, which means while everything is operational, we still have to work on fixing plenty of bugs. Do you have a suggestion for improving Basis? Please Fork the repo and create a pull request! You can also open an issue with the tag “improvement”. Not sure how to contribute but still wanting to help out? Consider donating! We appreciate any help possible.