// Update is called once per frame void FixedUpdate() { try { if (head != null && spedometer == null) { spedometer = head.gameObject.GetComponent <Rigidbody>(); } } catch { fakeConsole.text = "failed to set spedometer"; } if (OVRInput.GetDown(OVRInput.Button.One) || Input.GetButton("Submit")) { //fakeConsole.text = "trying to respawn"; head.Reset(); if (birdie != null) { GameObject.Destroy(birdie); birdie = null; birdControl = null; } birdie = GameObject.Instantiate(birdiePrefab); birdControl = birdie.GetComponent <BirdieController>(); if (OVRInput.GetDown(OVRInput.Button.SecondaryIndexTrigger) || OVRInput.GetDown(OVRInput.Button.Two) || Input.GetButtonDown("Jump")) { spawnLocation = racketCenter.transform.position + (new Vector3(0, -0.05f, 0.3f)); } birdControl.spawn(spawnLocation); } if (Input.GetAxis("Oculus_CrossPlatform_SecondaryThumbstickHorizontal") != 0) { foreach (Transform child in transform) { child.transform.Rotate(new Vector3(-Input.GetAxis("Oculus_CrossPlatform_SecondaryThumbstickHorizontal"), 0, 0)); } } if (OVRInput.GetDown(OVRInput.Button.SecondaryThumbstick)) { foreach (Transform child in transform) { child.transform.rotation.Set(0, 0, 0, 0); } } }
// Start is called before the first frame update void Start() { birdie = null; birdControl = null; }