private void StartCameras(Transform trackerTransform) { //subTrackers = new OculusCameraComponent[(int)OculusDevice.Tracker.Count]; for (int i = 0; i < OculusCameraComponent.GetCount(); i++) { OculusCameraComponent oculusCamera = OculusCameraComponent.Create(this); oculusCamera.subTrackerId = i; subTrackers.Add(oculusCamera); //subTrackers[i] = OculusCameraComponent.Create(this); //subTrackers[i].subTrackerId = i; } }
public static OculusCameraComponent Create(Tracker tracker) { GameObject cameraObject; Object cameraPrefab = Resources.Load("Oculus Camera"); if (cameraPrefab == null) { cameraObject = new GameObject(); } else { cameraObject = (GameObject)Instantiate(cameraPrefab); } cameraObject.name = "Oculus Camera"; cameraObject.transform.parent = tracker.trackerTransform; OculusCameraComponent cameraComponent = cameraObject.AddComponent <OculusCameraComponent>(); cameraComponent.tracker = tracker; return(cameraComponent); }