Gesture Recognizer

Description
I developed a Gesture Recognizer script with the purpose of creating a new interaction method for a game at viezel studios and now release for the community. It is completely a math based recognizer concept including tweakable parameters to adjust the CPU usage vs recognizer accuracy.

The gesture recognizer consists of three script files:

- gesture.js

- gestureRecognizer.js

- gestureTemplates.js

I used the TronTrail to display the gesture path while drawing it. Apply it to the FPS controller.

Usage
You can download a sample project with the complete setup here: [[Media:GestureReg.zip‎| GestureReg.zip‎]]

UPDATE UPDATE UPDATE

Gabriel Cirera, from CosmonautGames contacted me today with a C# edition of my code.. Thanks for that, I guess alot could use this instead of the javascript! [[Media:GestureRecognizerC-.zip‎‎| GestureRecognizerC#‎]]

UPDATE UPDATE UPDATE

JavaScript - gesture.js
Gesture.js is the main script file. It contains the functionality of controlling the events and recording the user’s inputs to the system. Add this script to an empty game object. Within Start the MouseLook script in the camera component is disabled, for optimal control with the purpose of gesture recognition.

The user right clicks (held down) in order to draw a gesture in the 3D scene. When released the recognizer starts. The gesture will be recorded and added to the gesture template bank if the user hold down CTRL while right clicking.

JavaScript - gestureRecognizer.js
The gestureRecognizer.js script is based on the three steps:

'''Step 1. Optimize gesture'''

'''Step 2. Rotate & scale gesture'''

'''Step 3. Match gesture against a set of templates'''

As seen underneath there are four settings variables for the recognizer adjusting the accuracy and the CPU consuming the technique requires. From the gestures.js file the function startRecognizer is executed. This is the main function of the entire project. startRecognizer follows the four steps of the article and returns a result if the gesture drawn by the user matches any of the templates.

JavaScript - gestureTemplates.js
The gestureTemplates.js script is just holding the templates and names of all the gestures.

The best approach is to create your own templates for two reasons. These templates are optimized for resolution 1000 x 600. The second reason is that your game/application etc might find square, circle, triangle, cross, a, z, line and wave gesture a bit out of scope what you want.

You need at least two versions of each gesture. clockwise and counter clockwise, due to different users draws gesture differently. For optimal recognition record three or four versions of each gesture is recommended.

Thats all... Hope some will benefit from this

Mads Møller

viezel studios