Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Augmented Reality with Kinect

You're reading from   Augmented Reality with Kinect If you know C/C++ programming, then this book will give you the ability to develop augmented reality applications with Microsoft's Kinect. By the end of the course you will have created a complete game.

Arrow left icon
Product type Paperback
Published in Jul 2013
Publisher Packt
ISBN-13 9781849694384
Length 122 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Rui Wang Rui Wang
Author Profile Icon Rui Wang
Rui Wang
Arrow right icon
View More author details
Toc

Cutting the fruits


Now we really want to "cut" something instead of just seeing the trailing effect. To simplify the process, we should have the following prerequisite conditions:

  • The fruit and bomb objects are represented by a 2D RGBA image with a transparent background. The positions and states (whether sliced or not) are updated in every frame.

  • The fruit is thrown from the bottom of the screen with a random initial velocity. It will fall down because of gravity.

  • When the hand points reach the object image (in fact, a rectangle), it is divided into four parts as if sliced by a mystical ninja.

The code doesn't need to be related with Kinect, but we will have to pass the hand points and velocities to determine if a fruit object is cut. All these operations can be done in the update() function.

It is also important to find or create some fruit and bomb images (using cartoon styles may be a good idea). In this simple example, we choose the following ones:

Fruits/bomb images with a transparent background...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image