Пример #1
0
        protected virtual void Start()
        {
            checkShouldEnableHeadMounted();

            createController();
            _transformedUpdateFrame   = new Frame();
            _transformedFixedFrame    = new Frame();
            _untransformedUpdateFrame = new Frame();
            _untransformedFixedFrame  = new Frame();
            //add tcpserver

            tcpserver.InitSocket();
            tcpserver.mode = 2;
            fakehand       = AddHand.getHand();
        }
Пример #2
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
                _smoothedTrackingLatency.value = Mathf.Min(_smoothedTrackingLatency.value, 30000f);
                _smoothedTrackingLatency.Update((float)(leap_controller_.Now() - leap_controller_.FrameTimestamp()), Time.deltaTime);
#endif
                leap_controller_.GetInterpolatedFrameFromTime(_untransformedUpdateFrame, CalculateInterpolationTime() + (ExtrapolationAmount * 1000), CalculateInterpolationTime() - (BounceAmount * 1000));
            }
            else
            {
                leap_controller_.Frame(_untransformedUpdateFrame);
            }
            //i want to add sth here

            /*
             *
             */
            if (tcpserver.showfakehand)
            {
                if (tcpserver.fakehandchange)
                {
                    UnityEngine.Debug.Log("Change");
                    fakehand = AddHand.getHand(tcpserver.handid, tcpserver.database_info);

                    tcpserver.fakehandchange = false;
                }
                //UnityEngine.Debug.Log(fakehand.TimeVisible);
                AddHand.ToFrame(ref _untransformedUpdateFrame, fakehand);
            }
            //

            /*
             * if (_untransformedUpdateFrame.Hands.Count > 0)
             * {
             *  UnityEngine.Debug.Log(fakehand.Id + " " + fakehand.TimeVisible);
             *  UnityEngine.Debug.Log(AddHand.ToFrame(ref _untransformedUpdateFrame, fakehand));
             * }
             */
            //end
            imageTimeStamp = leap_controller_.FrameTimestamp();

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

                DispatchUpdateFrameEvent(_transformedUpdateFrame);
            }
        }