Example #1
0
        protected virtual void Update()
        {
#if UNITY_EDITOR
            if (EditorApplication.isCompiling)
            {
                EditorApplication.isPlaying = false;
                Debug.LogWarning("Unity hot reloading not currently supported. Stopping Editor Playback.");
            }
#endif

            Int64 unityTime = (Int64)(Time.time * 1e6);
            clockCorrelator.UpdateRebaseEstimate(unityTime);

            if (_useInterpolation)
            {
                Int64 unityOffsetTime = unityTime - _interpolationDelay * 1000;
                Int64 leapFrameTime   = clockCorrelator.ExternalClockToLeapTime(unityOffsetTime);
                _untransformedUpdateFrame = leap_controller_.GetInterpolatedFrame(leapFrameTime);
            }
            else
            {
                _untransformedUpdateFrame = leap_controller_.Frame();
            }

            //Null out transformed frame because it is now stale
            //It will be recalculated if it is needed
            _transformedUpdateFrame = null;
        }
Example #2
0
        protected IEnumerator waitCoroutine()
        {
            WaitForEndOfFrame endWaiter = new WaitForEndOfFrame();

            while (true)
            {
                yield return(endWaiter);

                Int64 unityTime = (Int64)(Time.time * 1e6);
                clockCorrelator.UpdateRebaseEstimate(unityTime);
            }
        }
        protected virtual void Update()
        {
#if UNITY_EDITOR
            if (EditorApplication.isCompiling)
            {
                EditorApplication.isPlaying = false;
                Debug.LogWarning("Unity hot reloading not currently supported. Stopping Editor Playback.");
            }
#endif

            Int64 unityTime = (Int64)(Time.time);
            clockCorrelator.UpdateRebaseEstimate(unityTime);

            Int64 unityFrameTime = (Int64)(CurrentFrame.Timestamp - _initialFrameOffset);
            Int64 LeapFrameTime  = clockCorrelator.ExternalClockToLeapTime(unityFrameTime);

            if (_perFrameFixedUpdateOffset > 0)
            {
                _smoothedFixedUpdateOffset.Update(_perFrameFixedUpdateOffset, Time.deltaTime);
                _perFrameFixedUpdateOffset = -1;
            }
        }