none
Hand Cursor Implementation RRS feed

  • Question

  • Hi!

    Anyone know if you can access the implementation of the Hand Cursor provided in SDK in ControlBasics Example? Because I would need to add a command when it starts moving and I can not find out where this is going to happen.
    Can someone help me?
    Thanks so much!

    Monday, September 11, 2017 8:21 AM

Answers

  • Have you tried debugging it? Seeing the values pre and post calculation?

    The implementation seems ok.

    Is the position it's stuck at specific? Like the window's top left or middle?

    UPDATE: Take a look here and bookmark this blog. Has a ton of Kinect related stuff.

    Seems like Mike scales the KinectPointerPoint prior to use. Perhaps CurrentPoint is in normalized coordinates. Put a breakpoint before SetCursor and a couple inside to see the values.

    Monday, September 11, 2017 1:48 PM

All replies

  • Most of them are parts of the dll itself which is closed source. What are you trying to do?
    Monday, September 11, 2017 9:00 AM
  • I would like to set the position of the mouse with the cursor position, but I can probably do so with the APIs provided in Microsoft.Kinect.Toolkit.Input. But what model should i use? Should I refer to KinectPointerPoint or CursorModel or anything else? Thank you
    Monday, September 11, 2017 9:09 AM
  • Are you using a KinectCoreWindow instance? If so there is a PointerMoved event in there. The EventArgs passed to it contain the CurrentPoint(I imagine in Window Coordinates).
    Monday, September 11, 2017 9:17 AM
  • Yes Nikolaos, I just did so, I put in the specific event handler the call to my class to set the cursor position of the mouse. Unfortunately, however, it does not work, the mouse does not move in any way. Would you have idea of why?

    This is the Event handler in my class that contain the engagement handler and the KinectCoreWindow instance:

    void kinectCoreWindow_PointerMoved(object sender, KinectPointerEventArgs e)
            {
                var kinectPointerPoint = e.CurrentPoint;
                mouseCursor.SetCursor((int)kinectPointerPoint.Position.X, (int)kinectPointerPoint.Position.Y);
                }

    My mouseCursor contain the method SetCursor(int x, int y) that move the system cursor in the window and it work.


    Monday, September 11, 2017 12:15 PM
  • Can you post your implementation for SetCursor?
    Monday, September 11, 2017 1:30 PM
  • Yes.
    public void SetCursor(int x, int y)
            {
                // Left boundary
                var xL = (int)App.Current.MainWindow.Left;
                // Right boundary
                var xR = xL + (int)App.Current.MainWindow.Width;
                // Top boundary
                var yT = (int)App.Current.MainWindow.Top;
                // Bottom boundary
                var yB = yT + (int)App.Current.MainWindow.Height;
    
                x += xL;
                y += yT;
    
                if (x < xL)
                {
                    x = xL;
                }
                else if (x > xR)
                {
                    x = xR;
                }
    
                if (y < yT)
                {
                    y = yT;
                }
                else if (y > yB)
                {
                    y = yB;
                }
    
                SetCursorPos(x, y);
            }

    Monday, September 11, 2017 1:33 PM
  • Have you tried debugging it? Seeing the values pre and post calculation?

    The implementation seems ok.

    Is the position it's stuck at specific? Like the window's top left or middle?

    UPDATE: Take a look here and bookmark this blog. Has a ton of Kinect related stuff.

    Seems like Mike scales the KinectPointerPoint prior to use. Perhaps CurrentPoint is in normalized coordinates. Put a breakpoint before SetCursor and a couple inside to see the values.

    Monday, September 11, 2017 1:48 PM