Skip to main content
Commonmark migration
Source Link

You can get a position relative to the screen resolution, then it's just a matter of tweaking the values to find what works.

From http://kinectxna.blogspot.ie/2012/02/tutorial-5-skeletal-tracking.html :

foreach (Joint joint in skeleton.Joints)
{
     Vector2 position = new Vector2((((0.5f * joint.Position.X) + 0.5f) * (resolution.X)), (((-0.5f * joint.Position.Y) + 0.5f) * (resolution.Y)));
     spriteBatch.Draw(img, new Rectangle(Convert.ToInt32(position.X), Convert.ToInt32(position.Y), 10, 10), Color.White);
}

Instead of drawing to this position you could use it in your update logic. The values aren't perfect but they should get you on the right track.

Edit:

If in fullscreen you'll want to find the current resolution of the user's monitor. You can find it using:

GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height

Just put this in place of resolution in the above code and you should be good to go.

If this doesn't work try:

graphics.PreferredBackBufferWidth

 

graphics.PreferredBackBufferHeight

Where graphics is the GraphicsDeviceManager (declared in the game's constructor when creating a new XNA game). Depending on the scaling of the game one or the other of these should work.

You can get a position relative to the screen resolution, then it's just a matter of tweaking the values to find what works.

From http://kinectxna.blogspot.ie/2012/02/tutorial-5-skeletal-tracking.html :

foreach (Joint joint in skeleton.Joints)
{
     Vector2 position = new Vector2((((0.5f * joint.Position.X) + 0.5f) * (resolution.X)), (((-0.5f * joint.Position.Y) + 0.5f) * (resolution.Y)));
     spriteBatch.Draw(img, new Rectangle(Convert.ToInt32(position.X), Convert.ToInt32(position.Y), 10, 10), Color.White);
}

Instead of drawing to this position you could use it in your update logic. The values aren't perfect but they should get you on the right track.

Edit:

If in fullscreen you'll want to find the current resolution of the user's monitor. You can find it using:

GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height

Just put this in place of resolution in the above code and you should be good to go.

If this doesn't work try:

graphics.PreferredBackBufferWidth

 

graphics.PreferredBackBufferHeight

Where graphics is the GraphicsDeviceManager (declared in the game's constructor when creating a new XNA game). Depending on the scaling of the game one or the other of these should work.

You can get a position relative to the screen resolution, then it's just a matter of tweaking the values to find what works.

From http://kinectxna.blogspot.ie/2012/02/tutorial-5-skeletal-tracking.html :

foreach (Joint joint in skeleton.Joints)
{
     Vector2 position = new Vector2((((0.5f * joint.Position.X) + 0.5f) * (resolution.X)), (((-0.5f * joint.Position.Y) + 0.5f) * (resolution.Y)));
     spriteBatch.Draw(img, new Rectangle(Convert.ToInt32(position.X), Convert.ToInt32(position.Y), 10, 10), Color.White);
}

Instead of drawing to this position you could use it in your update logic. The values aren't perfect but they should get you on the right track.

Edit:

If in fullscreen you'll want to find the current resolution of the user's monitor. You can find it using:

GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height

Just put this in place of resolution in the above code and you should be good to go.

If this doesn't work try:

graphics.PreferredBackBufferWidth

graphics.PreferredBackBufferHeight

Where graphics is the GraphicsDeviceManager (declared in the game's constructor when creating a new XNA game). Depending on the scaling of the game one or the other of these should work.

fullscreen fix
Source Link
kiliki
  • 133
  • 6

You can get a position relative to the screen resolution, then it's just a matter of tweaking the values to find what works.

From http://kinectxna.blogspot.ie/2012/02/tutorial-5-skeletal-tracking.html :

foreach (Joint joint in skeleton.Joints)
{
     Vector2 position = new Vector2((((0.5f * joint.Position.X) + 0.5f) * (resolution.X)), (((-0.5f * joint.Position.Y) + 0.5f) * (resolution.Y)));
     spriteBatch.Draw(img, new Rectangle(Convert.ToInt32(position.X), Convert.ToInt32(position.Y), 10, 10), Color.White);
}

Instead of drawing to this position you could use it in your update logic. The values aren't perfect but they should get you on the right track.

Edit:

If in fullscreen you'll want to find the current resolution of the user's monitor. You can find it using:

GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height

Just put this in place of resolution in the above code and you should be good to go.

If this doesn't work try:

graphics.PreferredBackBufferWidth

graphics.PreferredBackBufferHeight

Where graphics is the GraphicsDeviceManager (declared in the game's constructor when creating a new XNA game). Depending on the scaling of the game one or the other of these should work.

You can get a position relative to the screen resolution, then it's just a matter of tweaking the values to find what works.

From http://kinectxna.blogspot.ie/2012/02/tutorial-5-skeletal-tracking.html :

foreach (Joint joint in skeleton.Joints)
{
     Vector2 position = new Vector2((((0.5f * joint.Position.X) + 0.5f) * (resolution.X)), (((-0.5f * joint.Position.Y) + 0.5f) * (resolution.Y)));
     spriteBatch.Draw(img, new Rectangle(Convert.ToInt32(position.X), Convert.ToInt32(position.Y), 10, 10), Color.White);
}

Instead of drawing to this position you could use it in your update logic. The values aren't perfect but they should get you on the right track.

You can get a position relative to the screen resolution, then it's just a matter of tweaking the values to find what works.

From http://kinectxna.blogspot.ie/2012/02/tutorial-5-skeletal-tracking.html :

foreach (Joint joint in skeleton.Joints)
{
     Vector2 position = new Vector2((((0.5f * joint.Position.X) + 0.5f) * (resolution.X)), (((-0.5f * joint.Position.Y) + 0.5f) * (resolution.Y)));
     spriteBatch.Draw(img, new Rectangle(Convert.ToInt32(position.X), Convert.ToInt32(position.Y), 10, 10), Color.White);
}

Instead of drawing to this position you could use it in your update logic. The values aren't perfect but they should get you on the right track.

Edit:

If in fullscreen you'll want to find the current resolution of the user's monitor. You can find it using:

GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height

Just put this in place of resolution in the above code and you should be good to go.

If this doesn't work try:

graphics.PreferredBackBufferWidth

graphics.PreferredBackBufferHeight

Where graphics is the GraphicsDeviceManager (declared in the game's constructor when creating a new XNA game). Depending on the scaling of the game one or the other of these should work.

Source Link
kiliki
  • 133
  • 6

You can get a position relative to the screen resolution, then it's just a matter of tweaking the values to find what works.

From http://kinectxna.blogspot.ie/2012/02/tutorial-5-skeletal-tracking.html :

foreach (Joint joint in skeleton.Joints)
{
     Vector2 position = new Vector2((((0.5f * joint.Position.X) + 0.5f) * (resolution.X)), (((-0.5f * joint.Position.Y) + 0.5f) * (resolution.Y)));
     spriteBatch.Draw(img, new Rectangle(Convert.ToInt32(position.X), Convert.ToInt32(position.Y), 10, 10), Color.White);
}

Instead of drawing to this position you could use it in your update logic. The values aren't perfect but they should get you on the right track.