This site requires JavaScript, please enable it in your browser!

Greenfoot and Kinect

You can now use Greenfoot together with the Microsoft Kinect™ sensor. If you are planning to buy a Kinect for use with Greenfoot, please read the notes on purchasing a Kinect first.

(Download a high resolution version of this video - 58MB) Kinect module

The Kinect sensor was developed by Microsoft originally for use with the Xbox games console. It has, however, a standard USB connector, so it can easily be plugged into a standard PC or laptop.

The Greenfoot Kinect library allows you to easily access the Kinect from within your Greenfoot scenario and gives you an easy interface to track user movements of up to four people.

Installing the software

Broadly, to use Greenfoot with the Kinect, you need to follow five steps:

  1. Install the OpenNI framework (which provides the programming interface to our server)
  2. Install the NITE middleware (which provides the skeleton tracking)
  3. Install the Kinect OpenNI driver (which allows you to use the Kinect)
  4. Install our Kinect server (which provides a bridge between OpenNI and Greenfoot)
  5. Download and open the starting Greenfoot scenario

The first four steps are system specific. Follow the instructions for your operating system, then come back here and continue.

Windows (7/Vista/XP)
Ubuntu 10.10 (Maverick Meerkat)
Mac OS X

Greenfoot Example Projects

Download the zip file, extract it and open one of the several contained projects in Greenfoot.


Further Notes

Interacting with Kinect Server

Every time you want to use Greenfoot with Kinect, you'll need to be running the Kinect server on your local machine. Typically you won't need to do much with the server itself, it just runs in the background, with a little Greenfoot icon down in your system tray. To bring up the menu for the server, right-click on the icon. From there you can exit the server.

The server will take up some CPU time while it is doing active processing (tracking your skeleton from the image requires a fair bit of computation!). To stop it sucking up time for ever, the server will fall idle if there is no Greenfoot scenario connected to it for fifteen minutes. At this point the Greenfoot icon in the system tray will get a black line across it. It will startup again automatically when a Greenfoot scenario connects (it takes a couple of seconds to get going again) or you can right click on the Greenfoot icon and select Start from the menu.

Sharing a Kinect

You may find yourself with more people wanting to use a Kinect than you have Kinect sensors. This may be an after-school club with ten students and one Kinect, or it may be two university students sharing an office. It is generally the case that you spend ten minutes coding and then one minute testing with the Kinect, so there is opportunity to share, but plugging and unplugging the Kinect from one machine to another is quite tiresome. The following instructions tell you how to use one Kinect sensor with multiple users.

Using the Kinect with multiple users

Purchasing a Kinect

Microsoft have recently released a "Kinect for Windows" sensor (which is nearly twice the price of the XBox 360 Kinect). At the present time, we do not support the Kinect for Windows sensor with Greenfoot. So, confusingly, you should buy the Kinect for XBox, not Kinect for Windows. We are dependent on the OpenNI library, which doesn't yet support Kinect for Windows. We imagine this will be resolved eventually, but it is out of our control.

If you buy an XBox Kinect by itself (for example, this product from Amazon UK), you will receive a cable with power and a USB connection. You simply plug in the power, and then plug the USB into your PC. So anyone purchasing a Kinect on its own just to use it with the PC should be fine.

However, if you want an Xbox 360 to go with your Kinect, and you buy (or have already bought) a Kinect as part of an all-in-one-box bundle with an Xbox 360 (for example, this product from Amazon UK) you will not have the USB connector. You will have to buy that separately: this item for the USA, this one for the UK (although places like Amazon do sell equivalent unofficial cables much cheaper -- shop around).

At the time of writing, in the UK, an Xbox 360 250GB+Kinect costs 240 pounds, an Xbox 360 on its own costs 160, the Kinect on its own costs 105 and the cable from Microsoft costs 23 pounds. So total cost to buy the bundle and cable to connect it to the PC is 240+23=263, while buying the Xbox and Kinect separately is 160+105=265. In the USA, the figures are 400+35=435 dollars for the bundle and cable, and 300+140=440 dollars for separately. So at the moment, you may as well buy them separately if you want PC connectivity too (it's easier to get two items from one shop than order the cable separately from Microsoft); check the prices (in your own country!) when you come to buy.

Questions / problems / suggestions?

If you have any questions, ask on the discussion forum.