void Start() { EmptyPath(); SetUpVisualizer(); this.enabled = false; mPointer = GameManager.Instance.RightControllerEvents.gameObject.GetComponent <VRTK.VRTK_Pointer>(); mPointerRenderer = GameManager.Instance.RightControllerEvents.gameObject.GetComponent <VRTK.VRTK_StraightPointerRenderer>(); }
protected virtual VRTK_BasePointerRenderer GeneratePointerRenderer() { VRTK_BasePointerRenderer returnRenderer = GetComponentInChildren <VRTK_BasePointerRenderer>(); if (returnRenderer == null) { returnRenderer = gameObject.AddComponent <VRTK_StraightPointerRenderer>(); autogenPointerRenderer = (VRTK_StraightPointerRenderer)returnRenderer; } return(returnRenderer); }
void Start() { text = GameObject.Find("RedMenuText").GetComponent <Text>(); player = GameObject.Find("Head"); myPointer = GameObject.Find("Headset").GetComponent <VRTK_StraightPointerRenderer>(); Physics.gravity = Vector3.zero; float t = -45f; for (int e = 0; e < elevations.Length; e++) { elevations[e] = t; t += 5.625f; } int counter = 0; GameObject prefab = Resources.Load("Sphere") as GameObject; for (int i = 0; i < azimuths.Length; i++) { for (int j = 0; j < elevations.Length; j++) { GameObject player = GameObject.Find("Head"); Transform playerTransform = player.transform; Vector3 position = playerTransform.position; GameObject go = Instantiate(prefab) as GameObject; Rigidbody Rb; Rb = go.GetComponent <Rigidbody>(); Rb.isKinematic = true; float x = Mathf.Sin(azimuths[i] * Mathf.Deg2Rad) * radius; float y = Mathf.Cos(azimuths[i] * Mathf.Deg2Rad) * Mathf.Sin(elevations[j] * Mathf.Deg2Rad) * radius; float z = Mathf.Cos(azimuths[i] * Mathf.Deg2Rad) * Mathf.Cos(elevations[j] * Mathf.Deg2Rad) * radius; go.GetComponent <SphereScript>().aAngle = azimuths[i]; go.GetComponent <SphereScript>().eAngle = elevations[j]; go.transform.position = new Vector3(position.x - x, position.y + y, position.z + z); spheres[counter] = go; counter++; } } }