Custom Kinect Gestures in Unity3D? Here's how...


Peter Daukintis, Microsoft Technical Evangelist has been on a Kinect Unity roll recently. Today he answers a question that I've also seen asked often, custom gestures in Unity3D

Here's some of the other posts from Peter we've highlighted recently;

Kinect 4 Windows v2 – Custom Gestures in Unity

I have received a few questions recently about detecting Kinect custom gestures in Unity 3D and it seems that there are a few issues with getting this up and running. I have previously posted about Kinect Custom Gestures and also using ‘built-in’ gestures from the Kinect 4 Windows SDK inside Unity so it makes sense to complete the loop here. I’ll run through my experience. A few things to set up straight off the bat:

I created a new Unity project and selected to install the Visual Studio 2013 Tools Unity Package (not required but I like to debug using Visual Studio)

I imported some Unity Kinect custom packages: Assets > Import Package > Custom Package and then navigated to the Kinect Unity Package location on my local disk. (the Kinect unity package can be downloaded here Add both the Kinect and Kinect.VisualGestureBuilder packages.

Creating the Scene

As before, in this previous post I created an empty game object and also a new c# script and added the following code to detect the Kinect sensor, pull the body data, exposing it to other scripts and also to retrieve the body tracking ID which will be required to identify the body on which we are detecting the gestures. To keep things simple I assumed only one tracked body and as always remember this is intended as a sample so I may not be as careful with cleaning up event handlers, etc.



Find the sample project here.

Other useful resources:

Another working sample –

Project Information URL:

Project Source URL:

Contact Information:

The Discussion

  • User profile image

    Thanks for this example (and especially for your articels on VGB!). However, I would suggest checking for a change in trackingID before updating it in your CustomGestureDetector. I experienced heavy frame rate drops when using your implementation.Changing the method as follows solved it for me:

    public void SetTrackingId(ulong id)
        if (vgbFrameSource.TrackingId != id)   {
            vgbFrameReader.IsPaused = false;
            vgbFrameSource.TrackingId = id;
            vgbFrameReader.FrameArrived += this.Reader_GestureFrameArrived;


Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.