Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8244943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:01:35+00:00 2026-06-07T22:01:35+00:00

I’m trying to implement a Real-Time Strategy control scheme for the MS Kinect. So

  • 0

I’m trying to implement a Real-Time Strategy control scheme for the MS Kinect.
So far, I’ve got a cursor, which can be moved by moving your left Hand (or right, dependant on your handedness). I’ve got an Open-NI-based Kinect controller which sets up a skeleton for player-movements and delivers the wrist-, elbow-, shoulder- and body-center-coordinates to my application.
To project these wrist-coordinates to the screen, I’ve set up a Rectangle, which is situated slightly left/right from the player’s center and as long as the wrist moves inside the rectangle, the cursor moves on screen.
My problem is, that the XNA-Rectangle has the upper left corner as point of origin, i.e. the X-axis points right, as it “should”, but the Y-axis points down, while the Y-axis of the Kinect – coordinate system points up. This results in the cursor moving upwards on screen, when I move my hand down and vice versa. There’s no way for me to change anything with the Kinect-coordinate system, so is it possible to ‘flip’ the ‘coordinate system’ of the rectangle, so that it’s Y-axis points up,too?

Here’s the relevant code:

(from Calibrate()-Method:)

List<Vector3> joints = UDPlistener.getInstance().ParseCalibCoordinates(data);
//0 = Right Wrist 1 = Right Elbow 2 = Right Shoulder
//3 = Left Wrist  4 = Left Elbow 5 = Left Shoulder
//6 = Center
height = 762; 
width = 1024;            
switch (hand)
{
    case 0:
    cursorSpace = new Rectangle((int)(joints[6].X * 2) - 200, (int)(joints[6].Y * 2) + height, width, height);
    break;
    case 3:
    cursorSpace = new Rectangle((int)(joints[6].X * 2) - 1200, (int)(joints[6].Y * 2) + height, width, height);
    break;
}

public Point Cursor(String data)
{   
    List<Vector3> joints = UDPlistener.getInstance().ParsePlayCoordinates(data);
    //0 = Right Wrist 1 = Left Wrist 2 = Center
    double mhx = 0; //main hand x-coordinate
    double mhy = 0; // main hand y-coordinate
    switch (hand)
    {
        case 0:
        mhx = joints[hand].X;
        mhy = joints[hand].Y;
        break; 

        case 3:
        mhx = joints[hand-2].X;
        mhy = joints[hand-2].Y;
        break;                    
    }

int x; 
int y;
if (Math.Abs(mhx - mhxOld) < 1.0 || Math.Abs(mhy - mhyOld) < 1.0) 
//To remove jittering of the cursor
{
    x = (int) mhxOld * 2;
    y = (int) mhyOld * 2;  
}
else
{
    x = (int) mhx * 2;
    mhxOld = mhx;
    y = (int) mhy * 2;
    mhyOld = mhy;
}

Point cursor = new Point(0,0);

if (cursorSpace.Contains(x,y)) 
{
    cursor = new Point(x - cursorSpace.X, y - CursorSpace.Y);                    
    lastCursorPos = cursor;
    return cursor;                    
}

Sorry for the wall of text, I hope, I could make myself clear.

Thanks in advance,

KK

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T22:01:37+00:00Added an answer on June 7, 2026 at 10:01 pm

    I use an extension method for converting OpenNI coordinates. The following example maps the OpenNI coordinates to XNA coordinates in a 640×480 rectangle in the top left corner, represented as a Vector2 object.

    public static Vector2 ToXnaCoordinates(this Point3D point)
    {
        return new Vector2(
            point.X + 320,
            (point.Y - 240) * -1);
    }
    

    The magic that flips the y coordinate is the * -1 part.

    If you want to reach a rectangle of different size than 640×480, you need to scale the coordinates accordingly after conversion. Example:

    public static Vector2 ToScaledXnaCoordinates(this Point3D point, int rectSizeX, int rectSizeY)
    {
        return new Vector2(
            (point.X + 320) * rectSizeX / 640,
            (point.Y - 240) * -rectSizeY / 480);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am trying to render a haml file in a javascript response like so:
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.