From 333076dc159b44f13c4851faa786fc6d8a73911f Mon Sep 17 00:00:00 2001 From: Santiago Lo Coco Date: Thu, 7 Nov 2024 23:21:08 +0100 Subject: [PATCH] Add rotate speech command --- .../MixedRealitySpeechCommandsProfile.asset | 14 ++++++++++ Assets/Scenes/WebView.unity | 28 +++++++++++++++++++ Assets/Scripts/ConfigureOrbital.cs | 11 ++++++++ 3 files changed, 53 insertions(+) diff --git a/Assets/MixedRealityToolkit.Generated/CustomProfiles/MixedRealitySpeechCommandsProfile.asset b/Assets/MixedRealityToolkit.Generated/CustomProfiles/MixedRealitySpeechCommandsProfile.asset index 1174204..6560884 100644 --- a/Assets/MixedRealityToolkit.Generated/CustomProfiles/MixedRealitySpeechCommandsProfile.asset +++ b/Assets/MixedRealityToolkit.Generated/CustomProfiles/MixedRealitySpeechCommandsProfile.asset @@ -58,3 +58,17 @@ MonoBehaviour: id: 0 description: None axisConstraint: 0 + - localizationKey: + keyword: Rotate + keyCode: 273 + action: + id: 0 + description: None + axisConstraint: 0 + - localizationKey: + keyword: Unfollow + keyCode: 0 + action: + id: 0 + description: None + axisConstraint: 0 diff --git a/Assets/Scenes/WebView.unity b/Assets/Scenes/WebView.unity index 64e9fd6..dad5b17 100644 --- a/Assets/Scenes/WebView.unity +++ b/Assets/Scenes/WebView.unity @@ -7653,6 +7653,34 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 + - keyword: Rotate + response: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 1193822414} + m_TargetAssemblyTypeName: ConfigureOrbital, Assembly-CSharp + m_MethodName: RotateCanvasToFaceUser + 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 + - m_Target: {fileID: 2018722013} + m_TargetAssemblyTypeName: UnityEngine.AudioSource, UnityEngine + m_MethodName: PlayOneShot + m_Mode: 2 + m_Arguments: + m_ObjectArgument: {fileID: 8300000, guid: 4075162bd7e8d9b4387ba77aeb751a0d, type: 3} + m_ObjectArgumentAssemblyTypeName: UnityEngine.AudioClip, 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!82 &2018722013 diff --git a/Assets/Scripts/ConfigureOrbital.cs b/Assets/Scripts/ConfigureOrbital.cs index cd84d20..c969f50 100644 --- a/Assets/Scripts/ConfigureOrbital.cs +++ b/Assets/Scripts/ConfigureOrbital.cs @@ -44,4 +44,15 @@ public class ConfigureOrbital : MonoBehaviour } } } + + public void RotateCanvasToFaceUser() + { + List canvases = endpointLoader.GetInstantiatedItems(); + + foreach (GameObject canvas in canvases) + { + Vector3 directionToCamera = canvas.transform.position - Camera.main.transform.position; + canvas.transform.rotation = Quaternion.LookRotation(directionToCamera); + } + } }