Пример #1
0
        public void PromotePotentialHand(PersistentHand potential)
        {
            _Velocity.InitValue(potential.Velocity);
            _X.InitValue(potential.X);
            _Y.InitValue(potential.Y);
            _Z.InitValue(potential.Z);
            _Pitch.InitValue(potential.Pitch);
            _Roll.InitValue(potential.Roll);
            _Yaw.InitValue(potential.Yaw);
            _FingerCount.InitValue(potential.FingerCount);
            HandTracker.InitPosition(potential.HandTracker.CurrentPosition);
            FingerTracker.InitPosition(potential.FingerTracker.CurrentPosition);

            Id             = potential.Id;
            DetectedHand   = potential.DetectedHand;
            FinalHand      = potential.FinalHand;
            CurrentHand    = potential.CurrentHand;
            CurrentFPS     = potential.CurrentFPS;
            StabilizedHand = potential.StabilizedHand;

            potential.FinalHand                = potential.CurrentHand;
            potential.DetectedHand             = Hand.Invalid;
            potential.StabilizedHand           = Hand.Invalid;
            potential.CurrentHand              = Hand.Invalid;
            potential._Stabilized.CurrentValue = false;
            potential.Id = 0;
        }
Пример #2
0
        public bool Update(Frame frame)
        {
            if (IsFinalized)
            {
                return(true);
            }

            CurrentFPS = frame.CurrentFramesPerSecond;

            var hand = frame.Hand(Id);

            if (!hand.IsValid)
            {
                // Our hand is not in this frame,
                // but we won't give up for 25ms.
                if (frame.Timestamp - CurrentHandTime < 25000)
                {
                    return(true);
                }

                // Our hand is truly gone...
                FinalHand                = CurrentHand;
                DetectedHand             = Hand.Invalid;
                StabilizedHand           = Hand.Invalid;
                CurrentHand              = Hand.Invalid;
                _Stabilized.CurrentValue = false;
                Id = 0;
                return(true);
            }

            // We still exist in this frame, update current
            CurrentHand     = hand;
            CurrentHandTime = frame.Timestamp;

            if (!IsStabilized)
            {
                // Check for stabilization complete
                if (_Stabilized.Update(frame))
                {
                    StabilizedHand = hand;
                }
            }

            _Velocity.Update(frame);
            _X.Update(frame);
            _Y.Update(frame);
            _Z.Update(frame);
            if (_Velocity.CurrentValue < 300)
            {
                _Pitch.Update(frame);
                _Roll.Update(frame);
                _Yaw.Update(frame);
            }
            _FingerCount.Update(frame);
            HandTracker.Update(frame);
            FingerTracker.Update(frame);

            return(true);
        }
Пример #3
0
    private void OnTriggerEnter(Collider other)
    {
        FingerTracker fingerTracker = other.GetComponent <FingerTracker>();

        if (fingerTracker != null)
        {
            colldersCount++;
        }

        if (colldersCount == 2)
        {
            moveObjectWithPinchEvent.RaiseEvent();
        }
    }
Пример #4
0
    private void OnTriggerExit(Collider other)
    {
        FingerTracker fingerTracker = other.GetComponent <FingerTracker>();

        if (fingerTracker != null)
        {
            colldersCount--;
        }

        if (colldersCount < 0)
        {
            colldersCount = 0;
        }

        if (colldersCount < 2)
        {
            dropObjectWithEvent.RaiseEvent();
        }
    }
Пример #5
0
 public FingerEventArgs(Finger finger, FingerTracker fingerTracker)
 {
     this.fingerTracker = fingerTracker;
     this.finger = finger;
 }
Пример #6
0
 public FingerEventArgs(int id, Point3D position, FingerState fingerState, FingerTracker fingerTracker)
 {
     this.fingerTracker = fingerTracker;
     finger = new Finger(id, position, fingerState);
 }