Git Product home page Git Product logo

air-kinect-gesture-lib's Introduction

#Air-Kinect-Gesture-Lib

Air Kinect Gesture Lib is a code library for use with Adobe AIR 3.0 and the Microsoft Kinect Native Extension written by the as3NUI team.( https://github.com/AS3NUI/airkinect-2-core/ ) You will find all the sources and a swc file in the bin folder.

##Important notes

This project is not updated anymore, dependencies issues with the newest version of as3NUI might exist.

##Requirements

Actionscript IDE supporting AIR 3.0 projects. (Flash Builder 4.6, IntelliJ, FDT, ...) A working Kinect and the airkinect-2-core.ane file in your project (install informations here : http://as3nui.github.com/airkinect-2-core/)

##Gestures and movements available

Gestures :

  • GestureDirection.SWIPE_HORIZONTAL;
  • GestureDirection.SWIPE_RIGHT;
  • GestureDirection.SWIPE_LEFT;
  • GestureDirection.SWIPE_VERTICAL;
  • GestureDirection.SWIPE_UP;
  • GestureDirection.SWIPE_DOWN;
  • GestureDirection.SWIPE_DEPTH;
  • GestureDirection.SWIPE_FORWARD;
  • GestureDirection.SWIPE_BACKWARD;

Movements :

  • JumpMovement;
  • BendDownMovement;

##Syntax and code snippets

You will find an example class in this repository. You can use the ActionScript3 native event system or the as3 Signal developed by Robert Penner. ( https://github.com/robertpenner/as3-signals/ )

//instantiation of an ActionManager with the stage frame rate in parameter in order to compute the gestures analysis
_actionManager = new ActionManager(stage.frameRate);

//creation of a gesture to track the left swipe with the left hand
//the detection will dispatch a KinectGestureEvent.LEFT_SWIPE in this case
var rightHandLeftSwipe : LeftSwipe = new LeftSwipe(GesturePart.RIGHT_HAND);
rightHandLeftSwipe.dispatcher.addEventListener(KinectGestureEvent.LEFT_SWIPE, _leftSwipeWithRightHandOccured);
//then, if you need to remove your event Listener, you can do it this way
//rightHandLeftSwipe.dispatcher.removeEventListener(KinectGestureEvent.LEFT_SWIPE, _leftSwipeWithRightHandOccured);

//in order to works, don't forget to add your gestures and / or movements to your ActionManager instance
_actionManager.add(rightHandLeftSwipe);

Then in your enterFrame handler, add this line.

//ask your ActionManager to compute and analyze user's actions
_actionManager.compute(user);

Here some code to show you how to use Signal instead of ActionScript3 Event.

//by default, the dispatcher of all AUserAction will be an EventDispatcher but you can also use
//the AS3 Signals by passing an instance of ActionSignalDispatcher to the AUserAction instance
var jumpMovement : JumpMovement = new JumpMovement(new ActionSignalDispatcher());
jumpMovement.dispatcher.addSignalListener(_jumpMovementOccured);
//for a signal dispatcher, you can remove your listener this way
//jumpMovement.dispatcher.removeSignalListener(_jumpMovementOccured);

Multiple gesture manager.

//rather than create two gestures (UpSwipe and DownSwipe for example) you can use
//a VerticalSwipe to handle two gestures in only one instance
var leftHandVerticalSwipe : VerticalSwipe = new VerticalSwipe(GesturePart.LEFT_HAND);
leftHandVerticalSwipe.dispatcher.addEventListener(KinectGestureEvent.UP_SWIPE, _upSwipeWithLeftHandOccured);
leftHandVerticalSwipe.dispatcher.addEventListener(KinectGestureEvent.DOWN_SWIPE, _downSwipeWithLeftHandOccured);
//remove event listener like shown below
//leftHandVerticalSwipe.dispatcher.removeEventListener(KinectGestureEvent.UP_SWIPE, _upSwipeWithLeftHandOccured);
//leftHandVerticalSwipe.dispatcher.removeEventListener(KinectGestureEvent.DOWN_SWIPE, _downSwipeWithLeftHandOccured);
        	
//if you want to use Signal dispatcher with a two gestures handler (HorizontalSwipe, VerticalSwipe or DepthSwipe)
//you can listen to your signal callback with the method below
var leftFootHorizontalSwipe : HorizontalSwipe = new HorizontalSwipe(GesturePart.LEFT_FOOT, new ActionSignalDispatcher());
leftFootHorizontalSwipe.dispatcher.addSignalListener(_horizontalLeftFootSwipeDirectionOne);
ActionSignalDispatcher(leftFootHorizontalSwipe.dispatcher).addSecondSignalListener(_horizontalLeftFootSwipeDirectionTwo);
//with the same logic, you can easily remove your signal listener
//leftFootHorizontalSwipe.dispatcher.removeSignalListener(_horizontalLeftFootSwipeDirectionOne);
//ActionSignalDispatcher(leftFootHorizontalSwipe.dispatcher).removeSecondSignalListener(_horizontalLeftFootSwipeDirectionTwo);

##Contact

I am still looking for impressions, critiques and suggestions so don't hesitate to contact me. http://www.tonybeltramelli.com/contact
Follow me on Twitter @Tbeltramelli : http://twitter.com/#!/tbeltramelli/.

Have fun with this lib !

air-kinect-gesture-lib's People

Contributors

sunimalr avatar tonybeltramelli avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.