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 44e5aea..3c8caa6 100644 --- a/Assets/Wind_Turbine/Scripts/Windturbine.cs +++ b/Assets/Wind_Turbine/Scripts/Windturbine.cs @@ -14,16 +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>(); - + //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); ; @@ -65,6 +67,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)); }