Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Leap Motion Development Essentials

You're reading from  Leap Motion Development Essentials

Product type Book
Published in Oct 2013
Publisher Packt
ISBN-13 9781849697729
Pages 106 pages
Edition 1st Edition
Languages
Author (1):
Mischa Spiegelmock Mischa Spiegelmock
Profile icon Mischa Spiegelmock

Animating rotation


Now, we should start animating and rendering things. In a perfect world we could perform our own window.requestAnimationFrame() calls, fetching the latest Leap data frames with controller.frame() and repainting the Three.js scene, but at present such a setup is impossible to test due to the incomplete state of the LeapJS library.

Our demonstration integration with Three.js and LeapJS will be simplicity itself; we'll rotate our cute lil' unit cube according to the user's hand rotation. When new hand tracking updates come in from the controller, we'll rotate the cube according to the palm normal of the first returned hand.

A normal is like a ray projecting outward from a surface, representing its orientation. The palmNormal property of a Leap.Hand is expressed as a unit vector that points outward from the plane described by the palm of the hand. The use of a palm normal for rotating an object works nicely because we can describe the rotation of the cube based on the normal...

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 $15.99/month. Cancel anytime}