public bool InputCheck() { if (!SixenseCore.Device.BaseConnected) return false; controllerLeft = SixenseCore.Device.GetTrackerByIndex(0); controllerRight = SixenseCore.Device.GetTrackerByIndex(1); return controllerLeft != null && controllerRight != null; }
/// <summary> /// allocate the controllers, set fixed timestep if desired /// </summary> void OnEnable() { if (m_fixedUpdate) { Debug.Log("Fixxxed update"); m_fixedTime = Time.fixedDeltaTime; Time.fixedDeltaTime = 1.0f / 240 - Mathf.Epsilon; } if (ms_initialized) { Debug.LogWarning("Multiple SixenseCore Devices present. Ensure that you only have one instance in your scene.", gameObject); gameObject.SetActive(false); return; } if (m_driverInitialized) { ms_globalInitialized = true; ms_maxTrackers = Plugin.sxCoreGetMaxTrackedDevices(); ms_historySize = Plugin.sxCoreGetHistorySize(); ms_Trackers = new Tracker[ms_maxTrackers]; for (int i = 0; i < ms_maxTrackers; i++) { ms_Trackers[i] = new Tracker(this, i); } ms_initialized = true; } }
private Vector3 _GetRealPosition(Tracker con) { return con.Position * device.m_worldUnitScaleInMillimeters; }
void Update() { if (m_trackerBind == TrackerID.NONE) { enabled = false; return; } if (m_base != null) return; var bases = FindObjectsOfType<BaseVisual>(); foreach(var b in bases) { if(b.RegisterTracker(this)) { m_base = b; break; } } if(m_base == null) { m_model.enabled = false; m_controller = null; } else { m_model.enabled = true; } }