Cube rotation using Leap motion sensor + three.js


The problem I having now is that I have written some code that in theory would allow the leap motion to rotate a cube using quaternions along the x,y and z-axis. I have followed the main three.js rules by making a init function and an animate function. I have finished writing the code, but when I run it using XAMP on the apache server nothing happens. No errors show so I don’t know where I went wrong. I tried disabling “mesh.rotation.y” and “mesh.rotation.z” in the animate function, which made the cube just continuously rotate. Then I disabled “mesh.rotation.x” and “mesh.rotation.y” to see if would rotate differently but it didn’t, nothing happened. I have also attached all the files to get the project running to see if that helps to solve the problem. Any help or fixes would be much appreciated. It’s also my first time posting on this platform so I apologise if I didn’t exactly follow the posting guidelines if there are any.

HCI (2).zip (374.8 KB)

Maybe this will help.

also in the Collection of examples from
see eXtended eXamples