Ejemplo n.º 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.");
                return;
            }
#endif
            manualUpdateHasBeenCalledSinceUpdate = false;

            _fixedOffset.Update(Time.time - Time.fixedTime, Time.deltaTime);

            if (_frameOptimization == FrameOptimizationMode.ReusePhysicsForUpdate)
            {
                DispatchUpdateFrameEvent(_transformedFixedFrame);
                return;
            }

            if (_useInterpolation)
            {
#if !UNITY_ANDROID || UNITY_EDITOR
                _smoothedTrackingLatency.value = Mathf.Min(_smoothedTrackingLatency.value, 30000f);
#endif
                long timestamp = CalculateInterpolationTime() + (ExtrapolationAmount * 1000);
                _unityToLeapOffset = timestamp - (long)(Time.time * S_TO_NS);
            }
            else
            {
                _untransformedUpdateFrame = leap_controller_.Frame();
            }

            if (_untransformedUpdateFrame != null)
            {
                transformFrame(_untransformedUpdateFrame, _transformedUpdateFrame);
                FixedUpdate();
                DispatchUpdateFrameEvent(_transformedUpdateFrame);
            }
        }