From 46c163c252c00cbc52a59437a15777471aa10a35 Mon Sep 17 00:00:00 2001 From: Abdul Mukheem Shaik <mukheemuddin@gmail.com> Date: Tue, 28 May 2024 00:34:09 +0200 Subject: [PATCH 1/3] Fix for turbine not rotating --- Assets/SharedSpatialAnchors/Scripts/API.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Assets/SharedSpatialAnchors/Scripts/API.cs b/Assets/SharedSpatialAnchors/Scripts/API.cs index 7f97ace..fe48ff2 100644 --- a/Assets/SharedSpatialAnchors/Scripts/API.cs +++ b/Assets/SharedSpatialAnchors/Scripts/API.cs @@ -72,6 +72,12 @@ public class API : MonoBehaviourPunCallbacks, IPunObservable windTurbineWithMap = GameObject.FindGameObjectWithTag("Wind_Turbine_withMap"); + webSocketController = GameObject.FindGameObjectWithTag("WebController"); + webSocketControllerScript = webSocketController.GetComponent<WebSocketController>(); + + avatar = GameObject.FindGameObjectWithTag("Avatar"); + audioControllerScript = avatar.GetComponent<AudioController>(); + } void Update() @@ -90,13 +96,10 @@ public class API : MonoBehaviourPunCallbacks, IPunObservable public void OnButtonClick() { - webSocketController = GameObject.FindGameObjectWithTag("WebController"); - webSocketControllerScript = webSocketController.GetComponent<WebSocketController>(); + webSocketControllerScript.ConnectWithESP32(); StartCoroutine(GetText()); - - avatar = GameObject.FindGameObjectWithTag("Avatar"); - audioControllerScript = avatar.GetComponent<AudioController>(); + audioControllerScript.fn_call_AudioNarration2(); } From 187365ee355a652a4902e396305af47e72636a2c Mon Sep 17 00:00:00 2001 From: Abdul Mukheem Shaik <mukheemuddin@gmail.com> Date: Tue, 28 May 2024 01:00:04 +0200 Subject: [PATCH 2/3] Debugging in progress for nullreference Co-Authored-By: ZeinabBF <145973209+ZeinabBF@users.noreply.github.com> --- .../Prefabs/Resources/GUI.prefab | 12 +- .../Resources/Wind_Turbine_withMap.prefab | 6 +- .../Scenes/SharedSpatialAnchors.unity | 339 ++++++++++++++++++ Assets/SharedSpatialAnchors/Scripts/API.cs | 32 +- Assets/Wind_Turbine/Scripts/Windturbine.cs | 12 +- 5 files changed, 387 insertions(+), 14 deletions(-) diff --git a/Assets/SharedSpatialAnchors/Prefabs/Resources/GUI.prefab b/Assets/SharedSpatialAnchors/Prefabs/Resources/GUI.prefab index 08ac981..9bd4496 100644 --- a/Assets/SharedSpatialAnchors/Prefabs/Resources/GUI.prefab +++ b/Assets/SharedSpatialAnchors/Prefabs/Resources/GUI.prefab @@ -941,7 +941,7 @@ MonoBehaviour: observableSearch: 2 ObservedComponents: - {fileID: 4890728644967733183} - sceneViewId: 0 + sceneViewId: 8 InstantiationId: 0 isRuntimeInstantiated: 0 --- !u!114 &4890728644967733183 @@ -1249,7 +1249,7 @@ PrefabInstance: m_Modifications: - target: {fileID: -4586353448955332270, guid: 1837e416a7f023e4b9de7c449006ca42, type: 3} propertyPath: sceneViewId - value: 0 + value: 7 objectReference: {fileID: 0} - target: {fileID: -4586353448955332270, guid: 1837e416a7f023e4b9de7c449006ca42, type: 3} propertyPath: ObservedComponents.Array.size @@ -1468,20 +1468,20 @@ PrefabInstance: m_Modifications: - target: {fileID: -4740409285023748802, guid: ebcaad662ef2ae14ca92fbcd7a67ee56, type: 3} propertyPath: sceneViewId - value: 0 + value: 6 objectReference: {fileID: 0} - target: {fileID: -4740409285023748802, guid: ebcaad662ef2ae14ca92fbcd7a67ee56, type: 3} propertyPath: ObservedComponents.Array.size - value: 1 + value: 2 objectReference: {fileID: 0} - target: {fileID: -4740409285023748802, guid: ebcaad662ef2ae14ca92fbcd7a67ee56, type: 3} propertyPath: ObservedComponents.Array.data[0] value: - objectReference: {fileID: 4890728645620921254} + objectReference: {fileID: 1160440965950818012} - target: {fileID: -4740409285023748802, guid: ebcaad662ef2ae14ca92fbcd7a67ee56, type: 3} propertyPath: ObservedComponents.Array.data[1] value: - objectReference: {fileID: 0} + objectReference: {fileID: 4890728645620921254} - target: {fileID: 4293156748659161770, guid: ebcaad662ef2ae14ca92fbcd7a67ee56, type: 3} propertyPath: m_LocalPosition.y value: -132.3 diff --git a/Assets/SharedSpatialAnchors/Prefabs/Resources/Wind_Turbine_withMap.prefab b/Assets/SharedSpatialAnchors/Prefabs/Resources/Wind_Turbine_withMap.prefab index 84f4056..295b189 100644 --- a/Assets/SharedSpatialAnchors/Prefabs/Resources/Wind_Turbine_withMap.prefab +++ b/Assets/SharedSpatialAnchors/Prefabs/Resources/Wind_Turbine_withMap.prefab @@ -124,7 +124,7 @@ MonoBehaviour: ObservedComponents: - {fileID: 5762830989053361383} - {fileID: 5326010102002042226} - sceneViewId: 0 + sceneViewId: 4 InstantiationId: 0 isRuntimeInstantiated: 0 --- !u!114 &5762830989053361383 @@ -418,7 +418,7 @@ MonoBehaviour: - {fileID: 6433795997240961375} - {fileID: 7309076934599776581} - {fileID: 5643319099722428757} - sceneViewId: 0 + sceneViewId: 5 InstantiationId: 0 isRuntimeInstantiated: 0 --- !u!114 &6433795997240961375 @@ -507,7 +507,7 @@ PrefabInstance: m_Modifications: - target: {fileID: -9180565859901777493, guid: 8754aa5f3d45cec4980f02029a881f7d, type: 3} propertyPath: sceneViewId - value: 0 + value: 3 objectReference: {fileID: 0} - target: {fileID: -9180565859901777493, guid: 8754aa5f3d45cec4980f02029a881f7d, type: 3} propertyPath: Synchronization diff --git a/Assets/SharedSpatialAnchors/Scenes/SharedSpatialAnchors.unity b/Assets/SharedSpatialAnchors/Scenes/SharedSpatialAnchors.unity index c30486f..e594cad 100644 --- a/Assets/SharedSpatialAnchors/Scenes/SharedSpatialAnchors.unity +++ b/Assets/SharedSpatialAnchors/Scenes/SharedSpatialAnchors.unity @@ -155,6 +155,80 @@ Transform: m_Father: {fileID: 2982998299393685466} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &85093692 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 382264866490105690, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3} + propertyPath: m_Name + value: Wind_Turbine_withMap + objectReference: {fileID: 0} + - target: {fileID: 382264866490459002, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3} + propertyPath: m_RootOrder + value: 9 + objectReference: {fileID: 0} + - target: {fileID: 382264866490459002, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3} + propertyPath: m_LocalPosition.x + value: 2.664 + objectReference: {fileID: 0} + - target: {fileID: 382264866490459002, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 382264866490459002, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 382264866490459002, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 382264866490459002, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 382264866490459002, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 382264866490459002, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 382264866490459002, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 382264866490459002, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 382264866490459002, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2369382148363411835, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3} + propertyPath: sceneViewId + value: 4 + objectReference: {fileID: 0} + - target: {fileID: 4423142984711990833, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3} + propertyPath: sceneViewId + value: 5 + objectReference: {fileID: 0} + - target: {fileID: 5233951453890299482, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3} + propertyPath: sceneViewId + value: 3 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3} +--- !u!1 &85093693 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 382264866490105690, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3} + m_PrefabInstance: {fileID: 85093692} + m_PrefabAsset: {fileID: 0} --- !u!4 &214795174 stripped Transform: m_CorrespondingSourceObject: {fileID: 5414912244175512725, guid: 60fa00281e83b294583adc31df520fbe, type: 3} @@ -688,6 +762,271 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 799752897} m_CullTransparentMesh: 1 +--- !u!1001 &868975863 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 515667115, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 515667115, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 515667115, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 515667115, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 515667115, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 515667115, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1172936521, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1172936521, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1172936521, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1172936521, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1172936521, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1172936521, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 254070869872014363, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: sceneViewId + value: 7 + objectReference: {fileID: 0} + - target: {fileID: 1160440965950818012, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: windTurbineWithMap + value: + objectReference: {fileID: 85093693} + - target: {fileID: 1160440966322517371, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440966322517371, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440966322517371, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440966322517371, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440966322517371, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440966322517371, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440966516636514, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440966516636514, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440966516636514, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440966516636514, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440966516636514, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440966516636514, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440966591221005, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440966591221005, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440966591221005, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440966591221005, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440966591221005, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440966591221005, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440966832639534, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440966832639534, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440966832639534, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440966832639534, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440966832639534, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440966832639534, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440966914658193, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440966914658193, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440966914658193, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440966914658193, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440966914658193, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440966914658193, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440967716077673, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440967716077673, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440967716077673, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440967716077673, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440967716077673, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1160440967716077673, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4890728644967733176, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_Name + value: GUI + objectReference: {fileID: 0} + - target: {fileID: 4890728644967733177, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_RootOrder + value: 10 + objectReference: {fileID: 0} + - target: {fileID: 4890728644967733177, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_LocalPosition.x + value: -0.014 + objectReference: {fileID: 0} + - target: {fileID: 4890728644967733177, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_LocalPosition.y + value: 0.080064446 + objectReference: {fileID: 0} + - target: {fileID: 4890728644967733177, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_LocalPosition.z + value: 1.5369034 + objectReference: {fileID: 0} + - target: {fileID: 4890728644967733177, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4890728644967733177, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4890728644967733177, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4890728644967733177, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4890728644967733177, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4890728644967733177, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4890728644967733177, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4890728644967733180, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: sceneViewId + value: 8 + objectReference: {fileID: 0} + - target: {fileID: 9073052392764595868, guid: f63dfc218827d724ca684921f9c50719, type: 3} + propertyPath: sceneViewId + value: 6 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: f63dfc218827d724ca684921f9c50719, type: 3} --- !u!1 &869333010 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/SharedSpatialAnchors/Scripts/API.cs b/Assets/SharedSpatialAnchors/Scripts/API.cs index fe48ff2..927bd80 100644 --- a/Assets/SharedSpatialAnchors/Scripts/API.cs +++ b/Assets/SharedSpatialAnchors/Scripts/API.cs @@ -71,13 +71,38 @@ public class API : MonoBehaviourPunCallbacks, IPunObservable photonView.RPC("RPC_EmergencyButtonClick", RpcTarget.All); windTurbineWithMap = GameObject.FindGameObjectWithTag("Wind_Turbine_withMap"); - webSocketController = GameObject.FindGameObjectWithTag("WebController"); webSocketControllerScript = webSocketController.GetComponent<WebSocketController>(); - avatar = GameObject.FindGameObjectWithTag("Avatar"); audioControllerScript = avatar.GetComponent<AudioController>(); + if (windTurbineWithMap != null) + { + // Do something with myObject + Debug.Log("GameObject exists: " + windTurbineWithMap.name); + } + if (webSocketController != null) + { + // Do something with myObject + Debug.Log("GameObject exists: " + webSocketController.name); + } + if (webSocketControllerScript != null) + { + // Do something with myObject + Debug.Log("GameObject exists: " + webSocketControllerScript.name); + } + if (avatar != null) + { + // Do something with myObject + Debug.Log("GameObject exists: " + avatar.name); + } + if (audioControllerScript != null) + { + // Do something with myObject + Debug.Log("GameObject exists: " + audioControllerScript.name); + } + windTurbineController = windTurbineWithMap.transform.GetChild(0).gameObject; + windTurbineControllerScript = windTurbineController.GetComponent<Windturbine>(); } void Update() @@ -185,8 +210,7 @@ public void ExtractDataFromJson(string json) Debug.Log("Latest WS is - "+latestWS); } } - windTurbineController = windTurbineWithMap.transform.GetChild(0).gameObject; - windTurbineControllerScript = windTurbineController.GetComponent<Windturbine>(); + photonView = PhotonView.Get(this); photonView.RPC("RPC_GreenButtonClick", RpcTarget.All,windDirectionInDirectionTerms,LatestT+" C","Kista",latestWS+" m/s",true); } diff --git a/Assets/Wind_Turbine/Scripts/Windturbine.cs b/Assets/Wind_Turbine/Scripts/Windturbine.cs index 3b4e31b..8944e87 100644 --- a/Assets/Wind_Turbine/Scripts/Windturbine.cs +++ b/Assets/Wind_Turbine/Scripts/Windturbine.cs @@ -23,7 +23,16 @@ public class Windturbine : MonoBehaviour speed = Random.Range(75.0f, 86.0f); GUIdataGameObject = GameObject.FindGameObjectWithTag("GUIData"); apiScript = GUIdataGameObject.GetComponent<API>(); - + if (GUIdataGameObject != null) + { + // Do something with myObject + Debug.Log("GameObject exists: " + GUIdataGameObject.name); + } + if (apiScript != null) + { + // Do something with myObject + Debug.Log("GameObject exists: " + apiScript.name); + } //THis condition is to detach the map with the Wind turbine after Instantiating. This helps the map stick to the ground when the turbine rotates. GameObject.FindGameObjectWithTag("map").transform.SetParent(null); ; @@ -63,6 +72,7 @@ public class Windturbine : MonoBehaviour { Debug.Log("Rotate On it's Y-Axis"); endRotationY = apiScript.latestWD; + Debug.Log("endRotationY - Rotate On it's Y-Axis ----"+ endRotationY); StartCoroutine(RotateObject(startRotationY, endRotationY, 3.5f)); } From 9c15976da9bd4c31b480fd2dc6afbb53aa7d990a Mon Sep 17 00:00:00 2001 From: Abdul Mukheem Shaik <mukheemuddin@gmail.com> Date: Tue, 28 May 2024 01:31:43 +0200 Subject: [PATCH 3/3] several changes for reference initiation Co-Authored-By: ZeinabBF <145973209+ZeinabBF@users.noreply.github.com> --- .../Prefabs/Resources/GUI.prefab | 6 +- .../Resources/Wind_Turbine_withMap.prefab | 6 +- .../Scenes/SharedSpatialAnchors.unity | 339 ------------------ Assets/SharedSpatialAnchors/Scripts/API.cs | 45 +-- .../Scripts/SharedAnchorControlPanel.cs | 8 +- Assets/Wind_Turbine/Scripts/Windturbine.cs | 19 +- 6 files changed, 30 insertions(+), 393 deletions(-) diff --git a/Assets/SharedSpatialAnchors/Prefabs/Resources/GUI.prefab b/Assets/SharedSpatialAnchors/Prefabs/Resources/GUI.prefab index 9bd4496..665bee1 100644 --- a/Assets/SharedSpatialAnchors/Prefabs/Resources/GUI.prefab +++ b/Assets/SharedSpatialAnchors/Prefabs/Resources/GUI.prefab @@ -941,7 +941,7 @@ MonoBehaviour: observableSearch: 2 ObservedComponents: - {fileID: 4890728644967733183} - sceneViewId: 8 + sceneViewId: 0 InstantiationId: 0 isRuntimeInstantiated: 0 --- !u!114 &4890728644967733183 @@ -1249,7 +1249,7 @@ PrefabInstance: m_Modifications: - target: {fileID: -4586353448955332270, guid: 1837e416a7f023e4b9de7c449006ca42, type: 3} propertyPath: sceneViewId - value: 7 + value: 0 objectReference: {fileID: 0} - target: {fileID: -4586353448955332270, guid: 1837e416a7f023e4b9de7c449006ca42, type: 3} propertyPath: ObservedComponents.Array.size @@ -1468,7 +1468,7 @@ PrefabInstance: m_Modifications: - target: {fileID: -4740409285023748802, guid: ebcaad662ef2ae14ca92fbcd7a67ee56, type: 3} propertyPath: sceneViewId - value: 6 + value: 0 objectReference: {fileID: 0} - target: {fileID: -4740409285023748802, guid: ebcaad662ef2ae14ca92fbcd7a67ee56, type: 3} propertyPath: ObservedComponents.Array.size diff --git a/Assets/SharedSpatialAnchors/Prefabs/Resources/Wind_Turbine_withMap.prefab b/Assets/SharedSpatialAnchors/Prefabs/Resources/Wind_Turbine_withMap.prefab index 295b189..84f4056 100644 --- a/Assets/SharedSpatialAnchors/Prefabs/Resources/Wind_Turbine_withMap.prefab +++ b/Assets/SharedSpatialAnchors/Prefabs/Resources/Wind_Turbine_withMap.prefab @@ -124,7 +124,7 @@ MonoBehaviour: ObservedComponents: - {fileID: 5762830989053361383} - {fileID: 5326010102002042226} - sceneViewId: 4 + sceneViewId: 0 InstantiationId: 0 isRuntimeInstantiated: 0 --- !u!114 &5762830989053361383 @@ -418,7 +418,7 @@ MonoBehaviour: - {fileID: 6433795997240961375} - {fileID: 7309076934599776581} - {fileID: 5643319099722428757} - sceneViewId: 5 + sceneViewId: 0 InstantiationId: 0 isRuntimeInstantiated: 0 --- !u!114 &6433795997240961375 @@ -507,7 +507,7 @@ PrefabInstance: m_Modifications: - target: {fileID: -9180565859901777493, guid: 8754aa5f3d45cec4980f02029a881f7d, type: 3} propertyPath: sceneViewId - value: 3 + value: 0 objectReference: {fileID: 0} - target: {fileID: -9180565859901777493, guid: 8754aa5f3d45cec4980f02029a881f7d, type: 3} propertyPath: Synchronization diff --git a/Assets/SharedSpatialAnchors/Scenes/SharedSpatialAnchors.unity b/Assets/SharedSpatialAnchors/Scenes/SharedSpatialAnchors.unity index e594cad..c30486f 100644 --- a/Assets/SharedSpatialAnchors/Scenes/SharedSpatialAnchors.unity +++ b/Assets/SharedSpatialAnchors/Scenes/SharedSpatialAnchors.unity @@ -155,80 +155,6 @@ Transform: m_Father: {fileID: 2982998299393685466} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1001 &85093692 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 382264866490105690, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3} - propertyPath: m_Name - value: Wind_Turbine_withMap - objectReference: {fileID: 0} - - target: {fileID: 382264866490459002, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3} - propertyPath: m_RootOrder - value: 9 - objectReference: {fileID: 0} - - target: {fileID: 382264866490459002, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3} - propertyPath: m_LocalPosition.x - value: 2.664 - objectReference: {fileID: 0} - - target: {fileID: 382264866490459002, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 382264866490459002, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 382264866490459002, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 382264866490459002, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 382264866490459002, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 382264866490459002, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 382264866490459002, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 382264866490459002, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 382264866490459002, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2369382148363411835, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3} - propertyPath: sceneViewId - value: 4 - objectReference: {fileID: 0} - - target: {fileID: 4423142984711990833, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3} - propertyPath: sceneViewId - value: 5 - objectReference: {fileID: 0} - - target: {fileID: 5233951453890299482, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3} - propertyPath: sceneViewId - value: 3 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3} ---- !u!1 &85093693 stripped -GameObject: - m_CorrespondingSourceObject: {fileID: 382264866490105690, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3} - m_PrefabInstance: {fileID: 85093692} - m_PrefabAsset: {fileID: 0} --- !u!4 &214795174 stripped Transform: m_CorrespondingSourceObject: {fileID: 5414912244175512725, guid: 60fa00281e83b294583adc31df520fbe, type: 3} @@ -762,271 +688,6 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 799752897} m_CullTransparentMesh: 1 ---- !u!1001 &868975863 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 515667115, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_AnchorMax.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 515667115, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_AnchorMin.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 515667115, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_SizeDelta.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 515667115, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_SizeDelta.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 515667115, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_AnchoredPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 515667115, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_AnchoredPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1172936521, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_AnchorMax.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1172936521, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_AnchorMin.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1172936521, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_SizeDelta.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1172936521, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_SizeDelta.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1172936521, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_AnchoredPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1172936521, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_AnchoredPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 254070869872014363, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: sceneViewId - value: 7 - objectReference: {fileID: 0} - - target: {fileID: 1160440965950818012, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: windTurbineWithMap - value: - objectReference: {fileID: 85093693} - - target: {fileID: 1160440966322517371, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_AnchorMax.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440966322517371, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_AnchorMin.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440966322517371, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_SizeDelta.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440966322517371, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_SizeDelta.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440966322517371, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_AnchoredPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440966322517371, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_AnchoredPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440966516636514, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_AnchorMax.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440966516636514, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_AnchorMin.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440966516636514, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_SizeDelta.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440966516636514, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_SizeDelta.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440966516636514, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_AnchoredPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440966516636514, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_AnchoredPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440966591221005, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_AnchorMax.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440966591221005, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_AnchorMin.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440966591221005, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_SizeDelta.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440966591221005, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_SizeDelta.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440966591221005, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_AnchoredPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440966591221005, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_AnchoredPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440966832639534, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_AnchorMax.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440966832639534, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_AnchorMin.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440966832639534, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_SizeDelta.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440966832639534, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_SizeDelta.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440966832639534, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_AnchoredPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440966832639534, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_AnchoredPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440966914658193, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_AnchorMax.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440966914658193, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_AnchorMin.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440966914658193, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_SizeDelta.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440966914658193, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_SizeDelta.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440966914658193, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_AnchoredPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440966914658193, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_AnchoredPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440967716077673, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_AnchorMax.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440967716077673, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_AnchorMin.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440967716077673, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_SizeDelta.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440967716077673, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_SizeDelta.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440967716077673, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_AnchoredPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1160440967716077673, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_AnchoredPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4890728644967733176, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_Name - value: GUI - objectReference: {fileID: 0} - - target: {fileID: 4890728644967733177, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_RootOrder - value: 10 - objectReference: {fileID: 0} - - target: {fileID: 4890728644967733177, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_LocalPosition.x - value: -0.014 - objectReference: {fileID: 0} - - target: {fileID: 4890728644967733177, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_LocalPosition.y - value: 0.080064446 - objectReference: {fileID: 0} - - target: {fileID: 4890728644967733177, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_LocalPosition.z - value: 1.5369034 - objectReference: {fileID: 0} - - target: {fileID: 4890728644967733177, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 4890728644967733177, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4890728644967733177, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4890728644967733177, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4890728644967733177, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4890728644967733177, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4890728644967733177, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4890728644967733180, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: sceneViewId - value: 8 - objectReference: {fileID: 0} - - target: {fileID: 9073052392764595868, guid: f63dfc218827d724ca684921f9c50719, type: 3} - propertyPath: sceneViewId - value: 6 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: f63dfc218827d724ca684921f9c50719, type: 3} --- !u!1 &869333010 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/SharedSpatialAnchors/Scripts/API.cs b/Assets/SharedSpatialAnchors/Scripts/API.cs index 927bd80..51da41f 100644 --- a/Assets/SharedSpatialAnchors/Scripts/API.cs +++ b/Assets/SharedSpatialAnchors/Scripts/API.cs @@ -70,39 +70,7 @@ public class API : MonoBehaviourPunCallbacks, IPunObservable photonView = PhotonView.Get(this); photonView.RPC("RPC_EmergencyButtonClick", RpcTarget.All); - windTurbineWithMap = GameObject.FindGameObjectWithTag("Wind_Turbine_withMap"); - webSocketController = GameObject.FindGameObjectWithTag("WebController"); - webSocketControllerScript = webSocketController.GetComponent<WebSocketController>(); - avatar = GameObject.FindGameObjectWithTag("Avatar"); - audioControllerScript = avatar.GetComponent<AudioController>(); - - if (windTurbineWithMap != null) - { - // Do something with myObject - Debug.Log("GameObject exists: " + windTurbineWithMap.name); - } - if (webSocketController != null) - { - // Do something with myObject - Debug.Log("GameObject exists: " + webSocketController.name); - } - if (webSocketControllerScript != null) - { - // Do something with myObject - Debug.Log("GameObject exists: " + webSocketControllerScript.name); - } - if (avatar != null) - { - // Do something with myObject - Debug.Log("GameObject exists: " + avatar.name); - } - if (audioControllerScript != null) - { - // Do something with myObject - Debug.Log("GameObject exists: " + audioControllerScript.name); - } - windTurbineController = windTurbineWithMap.transform.GetChild(0).gameObject; - windTurbineControllerScript = windTurbineController.GetComponent<Windturbine>(); + } void Update() @@ -218,6 +186,17 @@ public void ExtractDataFromJson(string json) [PunRPC] public void RPC_GreenButtonClick(String windDirection,String locationTemperature,String location,String windSpeed,bool turn_WT_on_Y_Axis_val) { + windTurbineWithMap = GameObject.FindGameObjectWithTag("Wind_Turbine_withMap"); + webSocketController = GameObject.FindGameObjectWithTag("WebController"); + webSocketControllerScript = webSocketController.GetComponent<WebSocketController>(); + avatar = GameObject.FindGameObjectWithTag("Avatar"); + audioControllerScript = avatar.GetComponent<AudioController>(); + + + windTurbineController = windTurbineWithMap.transform.GetChild(0).gameObject; + windTurbineControllerScript = windTurbineController.GetComponent<Windturbine>(); + + Debug.Log("Latest WS is - " + windSpeed); windDirValue.SetText(windDirection); temperatureValue.SetText(locationTemperature); diff --git a/Assets/SharedSpatialAnchors/Scripts/SharedAnchorControlPanel.cs b/Assets/SharedSpatialAnchors/Scripts/SharedAnchorControlPanel.cs index a7cbdb0..523d502 100644 --- a/Assets/SharedSpatialAnchors/Scripts/SharedAnchorControlPanel.cs +++ b/Assets/SharedSpatialAnchors/Scripts/SharedAnchorControlPanel.cs @@ -373,14 +373,18 @@ public class SharedAnchorControlPanel : MonoBehaviour SampleController.Instance.Log("Trying to Spawn WT Object"); SampleController.Instance.Log(spawnPoint.position.ToString()); Debug.Log(spawnPoint.position); + + var networkedGUI = PhotonPun.PhotonNetwork.Instantiate(TwinTurbine_menuItem.name, new Vector3(-1f, 1f, 2f), Quaternion.identity); + var photonGrabbableGui = networkedGUI.GetComponent<PhotonGrabbableObject>(); + + //var networkedWindTurbine = PhotonPun.PhotonNetwork.Instantiate(TwinTurbine_windTurbine.name, new Vector3(Camera.main.transform.position.x,0, Camera.main.transform.position.z-2), Quaternion.identity); var networkedWindTurbine = PhotonPun.PhotonNetwork.Instantiate(TwinTurbine_windTurbine.name, new Vector3(0.0f, -0.2f, 0.5f), Quaternion.identity); var photonGrabbable = networkedWindTurbine.GetComponent<PhotonGrabbableObject>(); photonGrabbable.TransferOwnershipToLocalPlayer(); - var networkedGUI = PhotonPun.PhotonNetwork.Instantiate(TwinTurbine_menuItem.name, new Vector3(-1f,1f, 2f), Quaternion.identity); - var photonGrabbableGui = networkedGUI.GetComponent<PhotonGrabbableObject>(); + //photonGrabbableGui.TransferOwnershipToLocalPlayer(); diff --git a/Assets/Wind_Turbine/Scripts/Windturbine.cs b/Assets/Wind_Turbine/Scripts/Windturbine.cs index 8944e87..d7c00e3 100644 --- a/Assets/Wind_Turbine/Scripts/Windturbine.cs +++ b/Assets/Wind_Turbine/Scripts/Windturbine.cs @@ -14,25 +14,18 @@ public class Windturbine : MonoBehaviour public float startRotationY = 0f; public float endRotationY; - + private void OnEnable() + { + GUIdataGameObject = GameObject.FindGameObjectWithTag("GUIData"); + apiScript = GUIdataGameObject.GetComponent<API>(); + } // Start is called before the first frame update void Start() { angle = Random.Range(0.0f, 120.0f); speed = Random.Range(75.0f, 86.0f); - GUIdataGameObject = GameObject.FindGameObjectWithTag("GUIData"); - apiScript = GUIdataGameObject.GetComponent<API>(); - if (GUIdataGameObject != null) - { - // Do something with myObject - Debug.Log("GameObject exists: " + GUIdataGameObject.name); - } - if (apiScript != null) - { - // Do something with myObject - Debug.Log("GameObject exists: " + apiScript.name); - } + //THis condition is to detach the map with the Wind turbine after Instantiating. This helps the map stick to the ground when the turbine rotates. GameObject.FindGameObjectWithTag("map").transform.SetParent(null); ;