Example #1
0
        public double Update(IList <Body> skeletons, int bodyCount)
        {
            if (activeBody != null)
            {
                zoomRight = activeBody.Joints[JointType.HandRight].Position.X;

                // kinect units are in meters. Hence left - right is scaled from minHandDistance to maxHandDistance
                double handDistance = (zoomRightStart - zoomRight);

                bool zoomOut = (handDistance < 0);
                handDistance = Math.Abs(handDistance);
                handDistance = handDistance.Clamp(minHandDistance, maxHandDistance);

                double zoomFraction = calculateZoomFactor(handDistance, zoomOut);

                double returnValue = (zoomFraction / currentZoom);
                currentZoom = zoomFraction;

                if (!GestureUtils.IsZoomGestureActive(activeBody))
                {
                    activeBody = null;
                    //Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("DEACTIVATED\n");
                }
                return(returnValue);
            }
            return(1);
        }
Example #2
0
 public override string ErrorCheck()
 {
     if (GestureUtils.GetGesture <Gesture>(Fsm, GameObject, Gesture, Component, false) == null)
     {
         return("Gesture is missing");
     }
     return(null);
 }
Example #3
0
        public override void OnEnter()
        {
            gesture = GestureUtils.GetGesture <PressGesture>(Fsm, GameObject, Component, true);
            if (gesture == null)
            {
                LogError("Gesture is missing");
                return;
            }

            gesture.Pressed += gesturePressedHandler;
        }
Example #4
0
    /// <summary>
    /// Start this instance.
    /// </summary>
    void Start()
    {
        listener   = new Listener();
        controller = new Controller(listener);

        //This constructor can be called with parameters to change default precision values.
        gu = new GestureUtils();

        gi = new GestureInterpreter();
        gi.callbackInstance = this;
    }
Example #5
0
        public override void OnEnter()
        {
            gesture = GestureUtils.GetGesture <Gesture>(Fsm, GameObject, Gesture, Component, false);
            if (gesture == null)
            {
                LogError("Gesture is missing");
                return;
            }

            gesture.StateChanged += gestureStateChangedHandler;
        }
 private System.Collections.IEnumerator ActionNode77_no()
 {
     ActionNode119_key  = IntNode102;
     ActionNode119_hand = ActionNode75_left;
     // ActionNode
     while (this.DebugInfo("b650c064-1158-4d64-b429-56d62b2c1f71", "2e1347d4-50a6-40e2-9e29-0a555be53310", this) == 1)
     {
         yield return(null);
     }
     // Visit GestureUtils.isGestureSatisified
     GestureUtils.isGestureSatisified(ActionNode119_key, ActionNode119_hand, () => { System.StartCoroutine(ActionNode119_yes()); }, () => { System.StartCoroutine(ActionNode119_no()); });
     yield break;
 }
 private System.Collections.IEnumerator ActionNode119_no()
 {
     ActionNode95_key  = IntNode96;
     ActionNode95_hand = ActionNode75_left;
     // ActionNode
     while (this.DebugInfo("6c87a3da-3586-409b-ab68-3f56ce6f1348", "26fa5271-6740-4e31-8e9e-96efd3c4abe4", this) == 1)
     {
         yield return(null);
     }
     // Visit GestureUtils.isGestureSatisified
     GestureUtils.isGestureSatisified(ActionNode95_key, ActionNode95_hand, () => { System.StartCoroutine(ActionNode95_yes()); }, () => { System.StartCoroutine(ActionNode95_no()); });
     yield break;
 }
 private System.Collections.IEnumerator ActionNode95_no()
 {
     ActionNode120_key  = IntNode103;
     ActionNode120_hand = ActionNode75_left;
     // ActionNode
     while (this.DebugInfo("0f6a65f9-97c5-4c04-b607-69895038ff3a", "21f82ff7-ca5e-455f-9bec-36e5f5254592", this) == 1)
     {
         yield return(null);
     }
     // Visit GestureUtils.isGestureSatisified
     GestureUtils.isGestureSatisified(ActionNode120_key, ActionNode120_hand, () => { System.StartCoroutine(ActionNode120_yes()); }, () => { System.StartCoroutine(ActionNode120_no()); });
     yield break;
 }
 private System.Collections.IEnumerator ActionNode128_no()
 {
     ActionNode137_key  = IntNode138;
     ActionNode137_hand = ActionNode75_left;
     // ActionNode
     while (this.DebugInfo("124cdb4f-9a72-4b51-b8e6-e3b686410614", "9c14444c-0151-4c06-b9f3-87828a85ea9c", this) == 1)
     {
         yield return(null);
     }
     // Visit GestureUtils.isGestureSatisified
     GestureUtils.isGestureSatisified(ActionNode137_key, ActionNode137_hand, () => { System.StartCoroutine(ActionNode137_yes()); }, () => { System.StartCoroutine(ActionNode137_no()); });
     yield break;
 }
 private System.Collections.IEnumerator ActionNode137_no()
 {
     ActionNode141_key  = IntNode142;
     ActionNode141_hand = ActionNode75_left;
     // ActionNode
     while (this.DebugInfo("696d1bc1-8d07-46d6-91dc-3e9f9095fbee", "4f297f36-e4f7-4b4c-8e45-0804865a2c10", this) == 1)
     {
         yield return(null);
     }
     // Visit GestureUtils.isGestureSatisified
     GestureUtils.isGestureSatisified(ActionNode141_key, ActionNode141_hand, () => { System.StartCoroutine(ActionNode141_yes()); }, () => { System.StartCoroutine(ActionNode141_no()); });
     yield break;
 }
Example #11
0
        public override void OnEnter()
        {
            gesture = GestureUtils.GetGesture <SimplePanGesture>(Fsm, GameObject, Component, true);
            if (gesture == null)
            {
                LogError("Gesture is missing");
                return;
            }

            gesture.PanStarted   += gesturePanStartedHandler;
            gesture.Panned       += gesturePannedHandler;
            gesture.PanCompleted += gesturePanCompletedHandler;
        }
 private System.Collections.IEnumerator ActionNode120_no()
 {
     ActionNode128_key  = IntNode129;
     ActionNode128_hand = ActionNode75_left;
     // ActionNode
     while (this.DebugInfo("c4db65f6-2521-4ee9-96de-74990e6603b8", "e59a3bb6-2d85-4c93-9deb-c7263b07b692", this) == 1)
     {
         yield return(null);
     }
     // Visit GestureUtils.isGestureSatisified
     GestureUtils.isGestureSatisified(ActionNode128_key, ActionNode128_hand, () => { System.StartCoroutine(ActionNode128_yes()); }, () => { System.StartCoroutine(ActionNode128_no()); });
     yield break;
 }
Example #13
0
        internal bool IsActive(IList <Body> skeletons, int bodyCount)
        {
            if (activeBody == null && skeletons != null)
            {
                for (int i = 0; i < bodyCount; i++)
                {
                    Body body = skeletons[i];
                    if (GestureUtils.IsSnapBackGestureActive(body))
                    {
                        Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("SNAP_BACK Gesture detected.\n");
                        activeBody = body;
                        break;
                    }
                }
            }

            return(activeBody != null);
        }
        private float PAN_COMMAND_MULTIPLIER = -50.0f;  // Multiplier to convert from real world distance to AutoCAD viewport distance.

        public bool IsActive(IList <Body> skeletons, int bodyCount)
        {
            if (activeBody == null && skeletons != null)
            {
                for (int i = 0; i < bodyCount; i++)
                {
                    Body body = skeletons[i];
                    if (GestureUtils.IsGrabGestureActive(body))
                    {
                        activeBody       = body;
                        startPosition    = activeBody.Joints[JointType.HandLeft].Position;
                        previousPosition = startPosition;
                        break;
                    }
                }
            }

            return(activeBody != null);
        }
Example #15
0
        public bool IsActive(IList <Body> skeletons, int bodyCount)
        {
            if (activeBody == null && skeletons != null)
            {
                for (int i = 0; i < bodyCount; i++)
                {
                    Body body = skeletons[i];
                    if (body.Joints[JointType.Head].Position.Y != 0.0f &&
                        GestureUtils.isCommandPositionActive(body, 0.2f))
                    {
                        centerPosition = new Vector3d(body.Joints[JointType.HandLeft].Position.X, body.Joints[JointType.HandLeft].Position.Y, 0);
                        activeBody     = body;
                        break;
                    }
                }
            }

            return(activeBody != null);
        }
Example #16
0
 public bool IsActive(IList <Body> skeletons, int bodyCount)
 {
     if (activeBody == null && skeletons != null)
     {
         for (int i = 0; i < bodyCount; i++)
         {
             Microsoft.Kinect.Body body = skeletons[i];
             if (GestureUtils.IsZoomGestureActive(body))
             {
                 activeBody     = body;
                 currentZoom    = 1.0;
                 zoomRightStart = activeBody.Joints[JointType.HandRight].Position.X;
                 zoomRight      = zoomRightStart;
                 //Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("ZOOM\n");
                 break;
             }
         }
     }
     return(activeBody != null);
 }
        private MixedRealityPose?GetHandPose(Handedness hand, bool hasBeenGrabbed)
        {
            if ((trackedHand & hand) == hand)
            {
                if (HandJointService.IsHandTracked(hand) &&
                    ((GestureUtils.IsPinching(hand) && trackPinch) ||
                     (GestureUtils.IsGrabbing(hand) && trackGrab)))
                {
                    var jointTransform = HandJointService.RequestJointTransform(trackedHandJoint, hand);
                    var palmTransForm  = HandJointService.RequestJointTransform(TrackedHandJoint.Palm, hand);

                    if (hasBeenGrabbed ||
                        Vector3.Distance(gameObject.transform.position, jointTransform.position) <= grabDistance)
                    {
                        return(new MixedRealityPose(jointTransform.position, palmTransForm.rotation));
                    }
                }
            }

            return(null);
        }
Example #18
0
        public bool IsActive(IList <Body> skeletons, int bodyCount)
        {
            if (activeBody == null && skeletons != null)
            {
                for (int i = 0; i < bodyCount; ++i)
                {
                    Microsoft.Kinect.Body body = skeletons[i];

                    if (GestureUtils.IsOrbitGestureActive(body))
                    {
                        activeBody = body;
                        //Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("ORBIT\n");

                        // Record right hand location
                        toolStartPosition    = activeBody.Joints[JointType.HandRight].Position;
                        toolPreviousPosition = toolStartPosition;
                        break;
                    }
                }
            }
            return(activeBody != null);
        }
        private System.Collections.IEnumerator ActionNode76_no()
        {
            // PublishEventNode
            while (this.DebugInfo("d2ac992c-2c35-421f-af1e-a9c12500ef9e", "bf6405b3-8cb0-4225-9caf-42c5d45efbe8", this) == 1)
            {
                yield return(null);
            }
            var PublishEventNode183_Event = new HandVisibleEvent();

            System.Publish(PublishEventNode183_Event);
            PublishEventNode183_Result = PublishEventNode183_Event;
            ActionNode77_key           = IntNode85;
            ActionNode77_hand          = ActionNode75_left;
            // ActionNode
            while (this.DebugInfo("bf6405b3-8cb0-4225-9caf-42c5d45efbe8", "2e85193b-7f96-4150-a0cd-ed5a3e0a5015", this) == 1)
            {
                yield return(null);
            }
            // Visit GestureUtils.isGestureSatisified
            GestureUtils.isGestureSatisified(ActionNode77_key, ActionNode77_hand, () => { System.StartCoroutine(ActionNode77_yes()); }, () => { System.StartCoroutine(ActionNode77_no()); });
            yield break;
        }
Example #20
0
        public override void OnEnter()
        {
            gesture = GestureUtils.GetGesture <Gesture>(Fsm, GameObject, Gesture, Component, false);
            if (gesture == null)
            {
                LogError("Gesture is missing");
                return;
            }

            ITouchHit hit;

            gesture.GetTargetHitResult(out hit);
            var hit3d = hit as ITouchHit3D;

            if (hit3d == null)
            {
                return;
            }

            if (Collider != null)
            {
                Collider.Value = hit3d.Collider;
            }
            if (RigidBody != null)
            {
                RigidBody.Value = hit3d.Rigidbody;
            }
            if (Normal != null)
            {
                Normal.Value = hit3d.Normal;
            }
            if (Point != null)
            {
                Point.Value = hit3d.Point;
            }

            Finish();
        }
Example #21
0
        public Vector3d Update(IList <Body> skeletons, int bodyCount)
        {
            if (activeBody != null)
            {
                if (GestureUtils.isCommandPositionActive(activeBody, 0.5f) && !GestureUtils.IsToolPositionActive(activeBody, 0.2f))
                {
                    //if(GestureUtils.GetJointDistance(activeBody.Joints[JointType.HandTipLeft], activeBody.Joints[JointType.ThumbLeft]) <= 0.05f)
                    //{

                    //    return new Vector3d(0,0,0);
                    //    //centerPosition = new Vector3d(activeBody.Joints[JointType.HandLeft].Position.X, activeBody.Joints[JointType.HandLeft].Position.Y, 0);
                    //}

                    if (activeBody.Joints[JointType.HandLeft].Position.X != centerPosition.X || activeBody.Joints[JointType.HandLeft].Position.Y != centerPosition.Y)
                    {
                        Vector3d acceleration = new Vector3d(centerPosition.X - activeBody.Joints[JointType.HandLeft].Position.X, centerPosition.Y - activeBody.Joints[JointType.HandLeft].Position.Y, 0);

                        //Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("Acceleration: {0}\n", acceleration);
                        return(acceleration);
                    }
                }
            }

            if (activeBody != null)
            {
                // kinect units are in meters. Hence left - right is scaled from minHandDistance to maxHandDistance
                if (!GestureUtils.isCommandPositionActive(activeBody, 0.2f))
                {
                    count++;
                    //GestureUtils.ReleaseGesture(activeBody);
                    Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage($"DEACTIVATE PAN {count}\n");
                    activeBody = null;
                }
            }

            return(new Vector3d(0, 0, 0));
        }
Example #22
0
    /// <summary>
    /// Start this instance.
    /// </summary>
    void Start()
    {
        listener = new Listener();
        controller = new Controller(listener);

        //This constructor can be called with parameters to change default precision values.
        gu = new GestureUtils();

        gi = new GestureInterpreter();
        gi.callbackInstance = this;
    }
Example #23
0
        public virtual System.Collections.IEnumerator Execute()
        {
            ActionNode70_key    = IntNode105;
            ActionNode70_thumb  = BoolNode71;
            ActionNode70_index  = BoolNode71;
            ActionNode70_middle = BoolNode72;
            ActionNode70_fourth = BoolNode72;
            ActionNode70_fifth  = BoolNode72;
            // ActionNode
            while (this.DebugInfo("a876787c-d3b6-43dc-9673-ca5866291deb", "67b36efb-ac9d-427e-9d9c-512ac104e0cd", this) == 1)
            {
                yield return(null);
            }
            // Visit GestureUtils.registerGesture
            GestureUtils.registerGesture(ActionNode70_key, ActionNode70_thumb, ActionNode70_index, ActionNode70_middle, ActionNode70_fourth, ActionNode70_fifth);
            ActionNode111_key    = IntNode106;
            ActionNode111_thumb  = BoolNode71;
            ActionNode111_index  = BoolNode71;
            ActionNode111_middle = BoolNode71;
            ActionNode111_fourth = BoolNode72;
            ActionNode111_fifth  = BoolNode72;
            // ActionNode
            while (this.DebugInfo("67b36efb-ac9d-427e-9d9c-512ac104e0cd", "7cf242e3-b774-4d20-945d-1759f3efa0c1", this) == 1)
            {
                yield return(null);
            }
            // Visit GestureUtils.registerGesture
            GestureUtils.registerGesture(ActionNode111_key, ActionNode111_thumb, ActionNode111_index, ActionNode111_middle, ActionNode111_fourth, ActionNode111_fifth);
            ActionNode112_key    = IntNode107;
            ActionNode112_thumb  = BoolNode72;
            ActionNode112_index  = BoolNode71;
            ActionNode112_middle = BoolNode71;
            ActionNode112_fourth = BoolNode72;
            ActionNode112_fifth  = BoolNode72;
            // ActionNode
            while (this.DebugInfo("7cf242e3-b774-4d20-945d-1759f3efa0c1", "192e3404-a699-4f7b-8640-e2dfac68b774", this) == 1)
            {
                yield return(null);
            }
            // Visit GestureUtils.registerGesture
            GestureUtils.registerGesture(ActionNode112_key, ActionNode112_thumb, ActionNode112_index, ActionNode112_middle, ActionNode112_fourth, ActionNode112_fifth);
            ActionNode113_key    = IntNode108;
            ActionNode113_thumb  = BoolNode72;
            ActionNode113_index  = BoolNode71;
            ActionNode113_middle = BoolNode71;
            ActionNode113_fourth = BoolNode71;
            ActionNode113_fifth  = BoolNode72;
            // ActionNode
            while (this.DebugInfo("192e3404-a699-4f7b-8640-e2dfac68b774", "9cea2b15-4c88-40eb-bdd1-1809bf5c3dbb", this) == 1)
            {
                yield return(null);
            }
            // Visit GestureUtils.registerGesture
            GestureUtils.registerGesture(ActionNode113_key, ActionNode113_thumb, ActionNode113_index, ActionNode113_middle, ActionNode113_fourth, ActionNode113_fifth);
            ActionNode114_key    = IntNode109;
            ActionNode114_thumb  = BoolNode71;
            ActionNode114_index  = BoolNode71;
            ActionNode114_middle = BoolNode71;
            ActionNode114_fourth = BoolNode71;
            ActionNode114_fifth  = BoolNode71;
            // ActionNode
            while (this.DebugInfo("9cea2b15-4c88-40eb-bdd1-1809bf5c3dbb", "1e79d8a3-b784-4dfb-baa0-cd189321711f", this) == 1)
            {
                yield return(null);
            }
            // Visit GestureUtils.registerGesture
            GestureUtils.registerGesture(ActionNode114_key, ActionNode114_thumb, ActionNode114_index, ActionNode114_middle, ActionNode114_fourth, ActionNode114_fifth);
            ActionNode132_key    = IntNode133;
            ActionNode132_thumb  = BoolNode71;
            ActionNode132_index  = BoolNode72;
            ActionNode132_middle = BoolNode72;
            ActionNode132_fourth = BoolNode72;
            ActionNode132_fifth  = BoolNode72;
            // ActionNode
            while (this.DebugInfo("1e79d8a3-b784-4dfb-baa0-cd189321711f", "cc652384-a7b9-4580-9456-bca1c4243fc7", this) == 1)
            {
                yield return(null);
            }
            // Visit GestureUtils.registerGesture
            GestureUtils.registerGesture(ActionNode132_key, ActionNode132_thumb, ActionNode132_index, ActionNode132_middle, ActionNode132_fourth, ActionNode132_fifth);
            ActionNode135_key    = IntNode136;
            ActionNode135_thumb  = BoolNode72;
            ActionNode135_index  = BoolNode71;
            ActionNode135_middle = BoolNode71;
            ActionNode135_fourth = BoolNode72;
            ActionNode135_fifth  = BoolNode71;
            // ActionNode
            while (this.DebugInfo("cc652384-a7b9-4580-9456-bca1c4243fc7", "307f959d-2914-4aa7-b056-e224e1654c12", this) == 1)
            {
                yield return(null);
            }
            // Visit GestureUtils.registerGesture
            GestureUtils.registerGesture(ActionNode135_key, ActionNode135_thumb, ActionNode135_index, ActionNode135_middle, ActionNode135_fourth, ActionNode135_fifth);
            // PublishEventNode
            while (this.DebugInfo("307f959d-2914-4aa7-b056-e224e1654c12", "8cb82bb7-2d9d-452b-ba92-12398c02e1b6", this) == 1)
            {
                yield return(null);
            }
            var PublishEventNode81_Event = new GestureUpdateEvent();

            System.Publish(PublishEventNode81_Event);
            PublishEventNode81_Result = PublishEventNode81_Event;
            yield break;
        }