diff --git a/Assets/MixedRealityToolkit.Generated/CustomProfiles/MixedRealitySpeechCommandsProfile.asset b/Assets/MixedRealityToolkit.Generated/CustomProfiles/MixedRealitySpeechCommandsProfile.asset index ef2fab4..9890300 100644 --- a/Assets/MixedRealityToolkit.Generated/CustomProfiles/MixedRealitySpeechCommandsProfile.asset +++ b/Assets/MixedRealityToolkit.Generated/CustomProfiles/MixedRealitySpeechCommandsProfile.asset @@ -14,7 +14,7 @@ MonoBehaviour: m_EditorClassIdentifier: isCustomProfile: 1 startBehavior: 0 - recognitionConfidenceLevel: 1 + recognitionConfidenceLevel: 2 speechCommands: - localizationKey: keyword: Pointer @@ -37,3 +37,17 @@ MonoBehaviour: id: 0 description: None axisConstraint: 0 + - localizationKey: + keyword: Hello + keyCode: 0 + action: + id: 0 + description: None + axisConstraint: 0 + - localizationKey: + keyword: Follow + keyCode: 0 + action: + id: 0 + description: None + axisConstraint: 0 diff --git a/Assets/Scenes/WebView.unity b/Assets/Scenes/WebView.unity index 47ffea8..1d4d6e4 100644 --- a/Assets/Scenes/WebView.unity +++ b/Assets/Scenes/WebView.unity @@ -533,9 +533,10 @@ Transform: - {fileID: 1555317771} - {fileID: 2137857638} - {fileID: 704152376} + - {fileID: 1017185579} + - {fileID: 1193822413} - {fileID: 491721037} - {fileID: 2018722011} - - {fileID: 1017185579} m_Father: {fileID: 0} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -569,7 +570,7 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 425776887} - m_RootOrder: 3 + m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &491721038 MonoBehaviour: @@ -735,6 +736,10 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 2137857638} m_Modifications: + - target: {fileID: 1923600390656491344, guid: 4410a2a17e71713438d8cf4ebc93d9a4, type: 3} + propertyPath: m_Enabled + value: 1 + objectReference: {fileID: 0} - target: {fileID: 2311476450002457713, guid: 4410a2a17e71713438d8cf4ebc93d9a4, type: 3} propertyPath: m_Name value: WebView @@ -1430,7 +1435,7 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 425776887} - m_RootOrder: 5 + m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1017185580 MonoBehaviour: @@ -1636,6 +1641,52 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &1193822412 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1193822413} + - component: {fileID: 1193822414} + m_Layer: 0 + m_Name: ConfigureOrbital + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1193822413 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1193822412} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -0.080369346, y: 0.18654236, z: 0.96904194} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 425776887} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1193822414 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1193822412} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 487c06418920ab945bfc039c0ba92d8a, type: 3} + m_Name: + m_EditorClassIdentifier: + canvas1: {fileID: 1555317770} + canvas2: {fileID: 2137857637} --- !u!1 &1398365136 GameObject: m_ObjectHideFlags: 0 @@ -1952,6 +2003,8 @@ GameObject: - component: {fileID: 1555317777} - component: {fileID: 1555317776} - component: {fileID: 1555317780} + - component: {fileID: 1555317782} + - component: {fileID: 1555317781} m_Layer: 5 m_Name: FirstCanvas m_TagString: Untagged @@ -1967,7 +2020,7 @@ RectTransform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1555317770} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0.75} + m_LocalPosition: {x: 0, y: 0, z: 1} m_LocalScale: {x: 0.001, y: 0.001, z: 0.001} m_ConstrainProportionsScale: 0 m_Children: @@ -1979,7 +2032,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: -0.3, y: 0.2} + m_AnchoredPosition: {x: -0.3, y: 0.1} m_SizeDelta: {x: 600, y: 400} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1555317772 @@ -2068,7 +2121,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 5afd5316c63705643b3daba5a6e923bd, type: 3} m_Name: m_EditorClassIdentifier: - ShowTetherWhenManipulating: 0 + ShowTetherWhenManipulating: 1 IsBoundsHandles: 0 --- !u!114 &1555317777 MonoBehaviour: @@ -2136,7 +2189,7 @@ BoxCollider: m_GameObject: {fileID: 1555317770} m_Material: {fileID: 0} m_IsTrigger: 0 - m_Enabled: 1 + m_Enabled: 0 serializedVersion: 2 m_Size: {x: 1, y: 1, z: 1} m_Center: {x: 0, y: 0, z: 0} @@ -2154,6 +2207,49 @@ MonoBehaviour: m_EditorClassIdentifier: eventsToReceive: 0 debounceThreshold: 0.01 +--- !u!114 &1555317781 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1555317770} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 14c3d8a4208d4b649529822e217623d4, type: 3} + m_Name: + m_EditorClassIdentifier: + updateLinkedTransform: 0 + moveLerpTime: 0.1 + rotateLerpTime: 0.1 + scaleLerpTime: 0 + maintainScaleOnInitialization: 1 + smoothing: 1 + lifetime: 0 + orientationType: 0 + localOffset: {x: -0.3, y: 0.1, z: 0.75} + worldOffset: {x: 0, y: 0, z: 0} + useAngleStepping: 0 + tetherAngleSteps: 6 +--- !u!114 &1555317782 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1555317770} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b55691ad5b034fe6966763a6e23818d2, type: 3} + m_Name: + m_EditorClassIdentifier: + trackedTargetType: 0 + trackedHandedness: 3 + trackedHandJoint: 2 + transformOverride: {fileID: 0} + additionalOffset: {x: 0, y: 0, z: 0} + additionalRotation: {x: 0, y: 0, z: 0} + updateSolvers: 0 --- !u!1001 &1725194923 PrefabInstance: m_ObjectHideFlags: 0 @@ -2684,7 +2780,7 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 425776887} - m_RootOrder: 4 + m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &2018722012 MonoBehaviour: @@ -2748,6 +2844,22 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 + - keyword: Follow + response: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 1193822414} + m_TargetAssemblyTypeName: ConfigureOrbital, Assembly-CSharp + m_MethodName: ToggleOrbitalScript + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 persistentKeywords: 0 speechConfirmationTooltipPrefab: {fileID: 8046114618238072051, guid: 271778f6c957b524981067a81d238394, type: 3} --- !u!21 &2059116078 @@ -2873,6 +2985,8 @@ GameObject: - component: {fileID: 2137857640} - component: {fileID: 2137857639} - component: {fileID: 2137857647} + - component: {fileID: 2137857649} + - component: {fileID: 2137857648} m_Layer: 5 m_Name: SecondCanvas m_TagString: Untagged @@ -2888,7 +3002,7 @@ RectTransform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2137857637} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0.75} + m_LocalPosition: {x: 0, y: 0, z: 1} m_LocalScale: {x: 0.001, y: 0.001, z: 0.001} m_ConstrainProportionsScale: 0 m_Children: @@ -2900,7 +3014,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0.3, y: 0.2} + m_AnchoredPosition: {x: 0.3, y: 0.1} m_SizeDelta: {x: 600, y: 400} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &2137857639 @@ -3075,3 +3189,46 @@ MonoBehaviour: m_EditorClassIdentifier: eventsToReceive: 0 debounceThreshold: 0.01 +--- !u!114 &2137857648 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2137857637} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 14c3d8a4208d4b649529822e217623d4, type: 3} + m_Name: + m_EditorClassIdentifier: + updateLinkedTransform: 0 + moveLerpTime: 0.1 + rotateLerpTime: 0.1 + scaleLerpTime: 0 + maintainScaleOnInitialization: 1 + smoothing: 1 + lifetime: 0 + orientationType: 0 + localOffset: {x: 0.3, y: 0.1, z: 0.75} + worldOffset: {x: 0, y: 0, z: 0} + useAngleStepping: 0 + tetherAngleSteps: 6 +--- !u!114 &2137857649 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2137857637} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b55691ad5b034fe6966763a6e23818d2, type: 3} + m_Name: + m_EditorClassIdentifier: + trackedTargetType: 0 + trackedHandedness: 3 + trackedHandJoint: 2 + transformOverride: {fileID: 0} + additionalOffset: {x: 0, y: 0, z: 0} + additionalRotation: {x: 0, y: 0, z: 0} + updateSolvers: 0 diff --git a/Assets/Scripts/ConfigureOrbital.cs b/Assets/Scripts/ConfigureOrbital.cs new file mode 100644 index 0000000..59f0a3c --- /dev/null +++ b/Assets/Scripts/ConfigureOrbital.cs @@ -0,0 +1,67 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using Microsoft.MixedReality.Toolkit; +using Microsoft.MixedReality.Toolkit.Utilities; +using Microsoft.MixedReality.Toolkit.Utilities.Solvers; + +public class ConfigureOrbital : MonoBehaviour +{ + public GameObject canvas1; + public GameObject canvas2; + + private Orbital orbital1; + private Orbital orbital2; + private SolverHandler solverHandler1; + private SolverHandler solverHandler2; + + void Start() + { + if (canvas1 != null) + { + orbital1 = canvas1.GetComponent(); + solverHandler1 = canvas1.GetComponent(); + } + + if (canvas2 != null) + { + orbital2 = canvas2.GetComponent(); + solverHandler2 = canvas2.GetComponent(); + } + + if (orbital1 == null || solverHandler1 == null || orbital2 == null || solverHandler2 == null) + { + Debug.LogError("One or both Canvas objects are missing an Orbital or SolverHandler component."); + } + } + + public void ToggleOrbitalScript() + { + ToggleOrbitalForCanvas(orbital1, solverHandler1); + ToggleOrbitalForCanvas(orbital2, solverHandler2); + } + + private void ToggleOrbitalForCanvas(Orbital orbital, SolverHandler solverHandler) + { + if (orbital != null && solverHandler != null) + { + orbital.enabled = !orbital.enabled; + + if (orbital.enabled) + { + Vector3 headPosition = Camera.main.transform.position; + // Quaternion headRotation = Camera.main.transform.rotation; + // Vector3 relativePosition = Quaternion.Inverse(headRotation) * (orbital.transform.position - headPosition); + Vector3 relativePosition = (orbital.transform.position - headPosition); + + orbital.LocalOffset = relativePosition; + + solverHandler.UpdateSolvers = true; + } + else + { + solverHandler.UpdateSolvers = false; + } + } + } +} diff --git a/Assets/Scripts/ConfigureOrbital.cs.meta b/Assets/Scripts/ConfigureOrbital.cs.meta new file mode 100644 index 0000000..12b22b3 --- /dev/null +++ b/Assets/Scripts/ConfigureOrbital.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 487c06418920ab945bfc039c0ba92d8a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/ProjectSettings/Physics2DSettings.asset b/ProjectSettings/Physics2DSettings.asset index 47880b1..6cfcdda 100644 --- a/ProjectSettings/Physics2DSettings.asset +++ b/ProjectSettings/Physics2DSettings.asset @@ -3,7 +3,7 @@ --- !u!19 &1 Physics2DSettings: m_ObjectHideFlags: 0 - serializedVersion: 4 + serializedVersion: 5 m_Gravity: {x: 0, y: -9.81} m_DefaultMaterial: {fileID: 0} m_VelocityIterations: 8 @@ -38,7 +38,7 @@ Physics2DSettings: m_IslandSolverJointCostScale: 10 m_IslandSolverBodiesPerJob: 50 m_IslandSolverContactsPerJob: 50 - m_AutoSimulation: 1 + m_SimulationMode: 0 m_QueriesHitTriggers: 1 m_QueriesStartInColliders: 1 m_CallbacksOnDisable: 1 diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 9edf22e..1a301bd 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -138,7 +138,9 @@ PlayerSettings: 16:9: 1 Others: 1 bundleVersion: 0.1 - preloadedAssets: [] + preloadedAssets: + - {fileID: 3919825601010146741, guid: 3f9164acd8abd4446a837f0de5c295d6, type: 2} + - {fileID: -8850236580838408871, guid: c00f5eb6c0921504a9911f55c664e377, type: 2} metroInputSource: 0 wsaTransparentSwapchain: 0 m_HolographicPauseOnTrackingLoss: 1