Beispiel #1
0
    bool TryInit()
    {
        lock (m_fusion_lock) {
            if (m_fusion == null)
            {
                m_fusion = LpmsVrInterface.factory(sensorId);
            }

            if (m_fusion == null)
            {
                Debug.LogError("SensorFusion did not start", this);
                return(false);
            }

            float fps = UnityEngine.VR.VRDevice.refreshRate;
            m_fusion.setLatencyTuning(nFramesAddedLatency / fps);

            if (axisMismatchCorrection >= 0)
            {
                m_fusion.setAssemblyRotation(axisMismatchCorrection);
            }
        }
        Camera.onPreCull += OnCameraPreCull;

        return(true);
    }
Beispiel #2
0
    void OnDisable()
    {
        lock (m_fusion_lock) {
            if (m_fusion != null)
            {
                Camera.onPreCull -= OnCameraPreCull;

                Debug.Log("Stopping lpSensorfusion", this);
                m_fusion = null;
            }
        }
    }