Description
Today's project provides a cool reusable Kinect XNA component. Being reusable makes adding Kinect features to your XNA based games almost plug-n-play simple...
XNA a Kinect Component
So, I have been playing about with the Kinect Beta, having finally got a power supply for my Kinect sensor (I got a Slim XBox). I am not doing a great deal with this post, just thought if you have a sensor you might want to start playing with it in XNA, so I have created a component you can use to get the video, depth and skeletal data back from the device.
Forgive the state of my living room, but this shows the video and depth data being retrieved from the device, notice the FPS is at 30, the project will run at 60, but the sensor runs at 30, so it gets a bit jittery if you are running at 60 FPS, so I have restricted it to 30.
So here is the simple component you can use to get data back from the device.
Project Information URL: http://xna-uk.net/blogs/randomchaos/archive/2011/10/19/xna-a-kinect-component.aspx
Project Source URL: http://xna-uk.net/blogs/randomchaos/archive/2011/10/19/xna-a-kinect-component.aspx
kinect = new KinectXNAComponent(this); spriteBatch.Begin(SpriteSortMode.Immediate,BlendState.Opaque); if (kinect.depthMap != null) { spriteBatch.Draw(kinect.depthMap, new Rectangle(GraphicsDevice.Viewport.Width / 2, 0, GraphicsDevice.Viewport.Width / 2, GraphicsDevice.Viewport.Height / 2), Color.White); } if (kinect.colorMap != null) { GraphicsDevice.VertexSamplerStates[0] = SamplerState.LinearClamp; spriteBatch.Draw(kinect.colorMap, new Rectangle(0, 0, GraphicsDevice.Viewport.Width / 2, GraphicsDevice.Viewport.Height / 2), Color.White); } if (kinect.renderJoints != null) { int sc = kinect.renderJoints.Count; for (int s = 0; s < sc; s++) { spriteBatch.Draw(jointImage, new Rectangle(kinect.renderJoints[s].X, kinect.renderJoints[s].Y, 8, 8), Color.Gold); } } spriteBatch.End();
Contact Information:
- Blog: http://xna-uk.net/blogs/randomchaos
- Twitter: @NemoKrad
The Discussion
-
tony good
-
Rodrigo Hi!
This kinect that you are defining as a KinectXNAComponent is a Runtime, right?
Thanks and sorry about the english, i'm brazillian and i'm just learning how to write in english. I want to create things with kinect, but in brazillian sites it's almost impossible to see references.
Conversation locked
This conversation has been locked by the site admins. No new comments can be made.