Merge branch 'main' into Fixing_Rotation_issue

This commit is contained in:
Abdul Mukheem Shaik 2024-05-28 05:08:53 +02:00
commit 13c5e18d60
2 changed files with 13 additions and 6 deletions
Assets
SharedSpatialAnchors/Scripts
Wind_Turbine/Scripts

@ -373,14 +373,18 @@ public class SharedAnchorControlPanel : MonoBehaviour
SampleController.Instance.Log("Trying to Spawn WT Object"); SampleController.Instance.Log("Trying to Spawn WT Object");
SampleController.Instance.Log(spawnPoint.position.ToString()); SampleController.Instance.Log(spawnPoint.position.ToString());
Debug.Log(spawnPoint.position); 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(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 networkedWindTurbine = PhotonPun.PhotonNetwork.Instantiate(TwinTurbine_windTurbine.name, new Vector3(0.0f, -0.2f, 0.5f), Quaternion.identity);
var photonGrabbable = networkedWindTurbine.GetComponent<PhotonGrabbableObject>(); var photonGrabbable = networkedWindTurbine.GetComponent<PhotonGrabbableObject>();
photonGrabbable.TransferOwnershipToLocalPlayer(); photonGrabbable.TransferOwnershipToLocalPlayer();
var networkedGUI = PhotonPun.PhotonNetwork.Instantiate(TwinTurbine_menuItem.name, new Vector3(-1f,1f, 2f), Quaternion.identity);
var photonGrabbableGui = networkedGUI.GetComponent<PhotonGrabbableObject>();
//photonGrabbableGui.TransferOwnershipToLocalPlayer(); //photonGrabbableGui.TransferOwnershipToLocalPlayer();

@ -14,16 +14,18 @@ public class Windturbine : MonoBehaviour
public float startRotationY = 0f; public float startRotationY = 0f;
public float endRotationY; public float endRotationY;
private void OnEnable()
{
GUIdataGameObject = GameObject.FindGameObjectWithTag("GUIData");
apiScript = GUIdataGameObject.GetComponent<API>();
}
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
angle = Random.Range(0.0f, 120.0f); angle = Random.Range(0.0f, 120.0f);
speed = Random.Range(75.0f, 86.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. //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); ; GameObject.FindGameObjectWithTag("map").transform.SetParent(null); ;
@ -65,6 +67,7 @@ public class Windturbine : MonoBehaviour
{ {
Debug.Log("Rotate On it's Y-Axis"); Debug.Log("Rotate On it's Y-Axis");
endRotationY = apiScript.latestWD; endRotationY = apiScript.latestWD;
Debug.Log("endRotationY - Rotate On it's Y-Axis ----"+ endRotationY);
StartCoroutine(RotateObject(startRotationY, endRotationY, 3.5f)); StartCoroutine(RotateObject(startRotationY, endRotationY, 3.5f));
} }