javascript - Three.js increase local object rotation -


my goal make object controls spaceship, understand need use quaternions achieve goal. start i'm trying make cube start rotating left press key, code that:

if(controls.pressinga === true) {     //var plocal = new three.vector3( 0, 0, -1 );     //var pworld = plocal.applymatrix4( me.matrixworld );     //var dir = pworld.sub( me.position ).normalize();     var dir = me.getworlddirection();     var quaternion = new three.quaternion().setfromaxisangle( dir, 0.05 );     me.rotation.setfromquaternion( quaternion ); } 

as understand code the me.getworlddirection() gets axis object facing, create quaternion on axis got before , rotate given object 0.05 degrees in rad, , last line of code apply quaternion object. problem got doesn't increase rotation, sets object given rotation, how can make increase rotation instead of setting it?

why don't use 1 or combination of:

mesh.rotation.x += 0.05; mesh.rotation.y += 0.05; mesh.rotation.z += 0.05; 

jsfiddle


Comments