RPC for a variable to see if WT is rotating or not using a different approach

Co-Authored-By: ZeinabBF <145973209+ZeinabBF@users.noreply.github.com>
This commit is contained in:
Abdul Mukheem Shaik 2024-05-27 21:56:57 +02:00
parent 90de0fc7a3
commit d3da4852dd
4 changed files with 93 additions and 1 deletions
Assets/SharedSpatialAnchors
ProjectSettings

@ -162,7 +162,7 @@ GameObject:
- component: {fileID: 2935496554514557820}
m_Layer: 0
m_Name: Wind_Turbine_withMap
m_TagString: Untagged
m_TagString: Wind_Turbine_withMap
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 2147483647

@ -2461,6 +2461,84 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: cd8280e8c381fbd4bbcad4b7ee581c31, type: 3}
--- !u!1001 &6073354290617709005
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: 8
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}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3}
--- !u!1 &6073354290617709006 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 382264866490105688, guid: a4966b3be785a2e4aaf3eb0c3ec8db1f, type: 3}
m_PrefabInstance: {fileID: 6073354290617709005}
m_PrefabAsset: {fileID: 0}
--- !u!54 &6073354290617709007
Rigidbody:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6073354290617709006}
serializedVersion: 2
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_UseGravity: 0
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!1001 &6512430749679280819
PrefabInstance:
m_ObjectHideFlags: 0

@ -8,6 +8,7 @@ using TMPro;
using UnityEngine;
using UnityEngine.Networking;
using WebSocketSharp;
using System.Linq;
//https://github.com/GlitchEnzo/NuGetForUnity
// Creating the data structure according to the expected Json
[Serializable]
@ -58,6 +59,10 @@ public class API : MonoBehaviour
[PunRPC]
public bool turn_WT_on_Y_Axis = false;
public GameObject windTurbineWithMap;
private GameObject windTurbineController;
private Windturbine windTurbineControllerScript;
void Start()
{
@ -66,6 +71,8 @@ public class API : MonoBehaviour
photonView = PhotonView.Get(this);
photonView.RPC("RPC_EmergencyButtonClick", RpcTarget.All);
windTurbineWithMap = GameObject.FindGameObjectWithTag("Wind_Turbine_withMap");
}
void Update()
@ -189,6 +196,12 @@ public void ExtractDataFromJson(string json)
loc.SetText(location);
windSpeedValue.SetText(windSpeed);
turn_WT_on_Y_Axis = turn_WT_on_Y_Axis_val; // flag set to true so that WT can rotate on it's Y axis.
windTurbineController = windTurbineWithMap.transform.GetChild(0).gameObject;
windTurbineControllerScript = windTurbineController.GetComponent<Windturbine>();
windTurbineControllerScript.WT_TurnOnIts_Y_Axis();
}
[PunRPC]
public void RPC_VoltageUpdate(String voltageGenerated)

@ -9,6 +9,7 @@ TagManager:
- GUIData
- Avatar
- map
- Wind_Turbine_withMap
layers:
- Default
- TransparentFX