IEnumerator InitializeLocation() { Input.location.Start(500, 500); int maxWait = 20; while (Input.location.status == LocationServiceStatus.Initializing && maxWait > 0) { yield return(new WaitForSeconds(0.5f)); maxWait--; } if (Input.location.status == LocationServiceStatus.Initializing) { yield break; } else if (Input.location.status == LocationServiceStatus.Failed) { yield break; } // Access granted and location value could be retrieved Util.logDebug("MobileLocation::InitializeLocation\nLocation: " + Input.location.lastData.latitude + " " + Input.location.lastData.longitude + " " + Input.location.lastData.altitude); CognitiveVR_Manager.UpdateSessionState("c3d.geo.latitude", Input.location.lastData.latitude); CognitiveVR_Manager.UpdateSessionState("c3d.geo.longitude", Input.location.lastData.longitude); CognitiveVR_Manager.UpdateSessionState("c3d.geo.altitude", Input.location.lastData.altitude); if (!CognitiveVR_Preferences.Instance.TrackGPSLocation) { Input.location.Stop(); } }
public override void CognitiveVR_Init(Error initError) { if (initError != Error.Success) { return; } base.CognitiveVR_Init(initError); CognitiveVR_Manager.UpdateSessionState(new Dictionary <string, object>() { { "cvr.vr.screenresolution", Screen.height + " x " + Screen.width } }); //CognitiveVR.Instrumentation.updateDeviceState(new Dictionary<string, object>() { { "cvr.vr.screenresolution", Screen.height + " x " + Screen.width } }); }
public override void CognitiveVR_Init(Error initError) { if (initError != Error.Success) { return; } base.CognitiveVR_Init(initError); #if CVR_OCULUS //TODO add oculus audio changed events CognitiveVR_Manager.UpdateSessionState(new Dictionary <string, object>() { { "cvr.vr.headphonespresent", OVRPlugin.headphonesPresent } }); #elif CVR_STEAMVR //TODO could check SteamVR_Ears if using speaker? #endif }
private void CognitiveVR_Manager_OnTick() { if (samples < SampleCount) { maxSqrDistance = Mathf.Max(maxSqrDistance, OVRInput.GetLocalControllerPosition(OVRInput.Controller.RTouch).sqrMagnitude, OVRInput.GetLocalControllerPosition(OVRInput.Controller.LTouch).sqrMagnitude); //maxSqrDistance = Mathf.Max(Vector3.SqrMagnitude(CognitiveVR_Manager.GetController(0).position - CognitiveVR_Manager.HMD.position)); samples++; if (samples >= SampleCount) { Util.logDebug("arm length " + maxSqrDistance); CognitiveVR_Manager.UpdateSessionState(new Dictionary <string, object> { { "cvr.armlength", Mathf.Sqrt(maxSqrDistance) } }); //Instrumentation.updateUserState(new Dictionary<string, object> { { "armlength", Mathf.Sqrt(maxSqrDistance) } }); CognitiveVR_Manager.TickEvent -= CognitiveVR_Manager_OnTick; } } }
private void CognitiveVR_Manager_OnTick() { if (CognitiveVR_Manager.HMD == null) { return; } if (samples < SampleCount) { hmdAccumHeight += CognitiveVR_Manager.HMD.position.y; samples++; if (samples >= SampleCount) { float averageHeight = hmdAccumHeight / samples; Util.logDebug("head height " + averageHeight); CognitiveVR_Manager.UpdateSessionState(new Dictionary <string, object> { { "cvr.height", averageHeight } }); CognitiveVR_Manager.TickEvent -= CognitiveVR_Manager_OnTick; } } }
public override void CognitiveVR_Init(Error initError) { if (initError != Error.Success) { return; } base.CognitiveVR_Init(initError); #if CVR_STEAMVR float roomX = 0; float roomY = 0; if (Valve.VR.OpenVR.Chaperone == null || !Valve.VR.OpenVR.Chaperone.GetPlayAreaSize(ref roomX, ref roomY)) { CognitiveVR_Manager.UpdateSessionState(new Dictionary <string, object>() { { "cvr.vr.roomsize", "0 x 0" }, { "cvr.vr.roomscale", false } }); //Instrumentation.updateDeviceState(new Dictionary<string, object>() { { "cvr.vr.roomsize", "0 x 0" }, { "cvr.vr.roomscale", false } }); } else { bool seated = Mathf.Approximately(roomX, 1f) && roomX == roomY; CognitiveVR_Manager.UpdateSessionState(new Dictionary <string, object>() { { "cvr.vr.roomsize", string.Format("{0:0.0} x {1:0.0}", roomX, roomY) }, { "cvr.vr.roomscale", !seated } }); //Instrumentation.updateDeviceState(new Dictionary<string, object>(){{ "cvr.vr.roomsize", string.Format("{0:0.0} x {1:0.0}", roomX, roomY) },{ "cvr.vr.roomscale", !seated }}); } #elif CVR_OCULUS //(x = width, y = height, z = depth) Vector3 dimensions = OVRManager.boundary.GetDimensions(OVRBoundary.BoundaryType.PlayArea); CognitiveVR_Manager.UpdateSessionState(new Dictionary <string, object>() { { "cvr.vr.roomsize", string.Format("{0:0.0} x {1:0.0}", dimensions.x, dimensions.z) } }); //Instrumentation.updateDeviceState(new Dictionary<string, object>(){{ "cvr.vr.roomsize", string.Format("{0:0.0} x {1:0.0}", dimensions.x, dimensions.z) }}); #endif }