public void Init(Configuration config) { CircleVRTrackerSetter[] setters = FindObjectsOfType <CircleVRTrackerSetter>(); if (setters.Length > 0) { foreach (var pair in config.circlevr.pairs) { CircleVRTrackerSetter result = null; foreach (var setter in setters) { if (setter.trackerID == pair.trackerID) { result = setter; break; } } if (!result) { CircleVRTrackingSystem.CreateTracker(pair.trackerID).gameObject.AddComponent <SimulateTracker>().Init(config.circlevr.safetyBarrierRadius); continue; } CircleVRTrackingSystem.CreateTracker(pair.trackerID).gameObject.AddComponent <SetterFollower>().Init(result); } return; } foreach (var pair in config.circlevr.pairs) { CircleVRTrackingSystem.CreateTracker(pair.trackerID).gameObject.AddComponent <SimulateTracker>().Init(config.circlevr.safetyBarrierRadius); } }
public void Update() { List <string> currentIDs = new List <string>(); var error = ETrackedPropertyError.TrackedProp_Success; for (uint i = 0; i < 16; i++) { var result = new StringBuilder(64); OpenVR.System.GetStringTrackedDeviceProperty(i, ETrackedDeviceProperty.Prop_RenderModelName_String, result, 64, ref error); if (result.ToString().Contains("tracker")) { StringBuilder id = new StringBuilder(64); OpenVR.System.GetStringTrackedDeviceProperty(i, ETrackedDeviceProperty.Prop_SerialNumber_String, id, 64, ref error); currentIDs.Add(id.ToString()); if (CircleVRTrackingSystem.HasTracker(id.ToString())) { continue; } SteamVR_TrackedObject trackedObj = CircleVRTrackingSystem.CreateTracker(id.ToString()).gameObject.AddComponent <SteamVR_TrackedObject>(); trackedObj.SetDeviceIndex((int)i); } } }
private void SetTrackerTransform(CircleVRHostNetwork.Packet.TrackerData trackerData) { Transform trackerTransform = CircleVRTrackingSystem.GetTracker(trackerData.onAirVRUserID); if (!CircleVRTrackingSystem.HasTracker(trackerData.onAirVRUserID)) { trackerTransform = CircleVRTrackingSystem.CreateTracker(trackerData.onAirVRUserID); } trackerTransform.localPosition = Vector3.Lerp(trackerTransform.localPosition, trackerData.position, 0.25f); trackerTransform.localRotation = Quaternion.Lerp(trackerTransform.localRotation, trackerData.oriented, 0.25f); }
private IEnumerator Start() { yield return(StartCoroutine(LoadConfigure())); DisplayInit(); Setup(config, maxClientCount, customizedRig); CircleVRTrackingSystem.Init(config, trackerOrigin); GameObject.DontDestroyOnLoad(gameObject); ContentName = contentName; }
public void OnBounded(string userID, AirVRStereoCameraRig rig) { this.userID = userID; Transform tracker = CircleVRTrackingSystem.GetTracker(CircleVR.GetPair(userID).trackerID); rig.externalTracker = tracker.Find("CenterAnchor"); CircleVRErrorType error; if (host.AddConnectedUserIDs(userID, out error)) { CircleVRDisplay.GetHead(CircleVR.GetPair(userID).trackerID).Connected = true; return; } Debug.Log("[Client Emulator] " + error.ToString()); }
private void UpdatePacket(Packet.TrackerData trackerData) { if (!CircleVR.HasUserIDInPairs(trackerData.onAirVRUserID)) { //TODO : must be notify in gui return; } Configuration.TrackerAndUserIDPair pair = CircleVR.GetPair(trackerData.onAirVRUserID); Transform tracker = CircleVRTrackingSystem.GetTracker(pair.trackerID); if (tracker == null) { //TODO : must be notify in gui return; } trackerData.position = tracker.localPosition; trackerData.oriented = tracker.localRotation; }
public Vector3 GetPosition() { return(CircleVRTrackingSystem.GetTracker(trackerID).position); }
public void SetDisplay(List <string> connectedUserIDs) { Queue <string> connectedQueue = new Queue <string>(); foreach (var connection in connectedUserIDs) { connectedQueue.Enqueue(connection); } List <DisplayLayoutCamera> list = cams.Values.ToList(); Transform t1; Transform t2; Transform t3; Transform t4; switch (connectedQueue.Count) { case 0: foreach (var cam in cams.Values) { if (cam.id == "observer") { continue; } DisplayLayoutFade fade = cam.GetComponent <DisplayLayoutFade>(); if (fade) { cam.StartCoroutine(fade.Fade(false)); } } break; case 1: t1 = CircleVRTrackingSystem.GetTracker(CircleVR.GetPair(connectedQueue.Dequeue()).trackerID).transform.Find("CenterAnchor"); foreach (var key in cams.Keys) { if (key == "observer") { continue; } ActivateDisplay(key, t1); } return; case 2: t1 = CircleVRTrackingSystem.GetTracker(CircleVR.GetPair(connectedQueue.Dequeue()).trackerID).transform.Find("CenterAnchor"); t2 = CircleVRTrackingSystem.GetTracker(CircleVR.GetPair(connectedQueue.Dequeue()).trackerID).transform.Find("CenterAnchor"); ActivateDisplay("display1", t1); switch (DisplayLayoutCamera.config.displays.Length) { case 3: ActivateDisplay("display2", t2); return; case 4: ActivateDisplay("display2", t2); ActivateDisplay("display3", t1); return; case 5: ActivateDisplay("display2", t2); ActivateDisplay("display3", t1); ActivateDisplay("display4", t2); return; } return; case 3: t1 = CircleVRTrackingSystem.GetTracker(CircleVR.GetPair(connectedQueue.Dequeue()).trackerID).transform.Find("CenterAnchor"); t2 = CircleVRTrackingSystem.GetTracker(CircleVR.GetPair(connectedQueue.Dequeue()).trackerID).transform.Find("CenterAnchor"); t3 = CircleVRTrackingSystem.GetTracker(CircleVR.GetPair(connectedQueue.Dequeue()).trackerID).transform.Find("CenterAnchor"); ActivateDisplay("display1", t1); ActivateDisplay("display2", t2); ActivateDisplay("display3", t3); ActivateDisplay("display4", t2); return; case 4: t1 = CircleVRTrackingSystem.GetTracker(CircleVR.GetPair(connectedQueue.Dequeue()).trackerID).transform.Find("CenterAnchor"); t2 = CircleVRTrackingSystem.GetTracker(CircleVR.GetPair(connectedQueue.Dequeue()).trackerID).transform.Find("CenterAnchor"); t3 = CircleVRTrackingSystem.GetTracker(CircleVR.GetPair(connectedQueue.Dequeue()).trackerID).transform.Find("CenterAnchor"); t4 = CircleVRTrackingSystem.GetTracker(CircleVR.GetPair(connectedQueue.Dequeue()).trackerID).transform.Find("CenterAnchor"); ActivateDisplay("display1", t1); ActivateDisplay("display2", t2); ActivateDisplay("display3", t3); ActivateDisplay("display4", t4); return; } }