jitter.gl.handle rotation problem
Oct 26, 2006 at 6:23pm
jitter.gl.handle rotation problemHi, When i move an 3d object with the mouse in a jitter.gl.handle object i can route rotate – to get a list of 4 numbers: one number is between 0 and 360 [a] [letter in brackets are what i guess these to be]
I need to convert these numbers into a format Blender will understand, either; –or– place them in this python script (by spike1907);
def matToEuler(): def eulerToMat(I, J, K): o.setOrientation( eulerToMat(45,0,0) ) I have tried multiplying the jit.gl.handle’s numbers to leave me with ax, ay and az. Then placing them into the script so the last line reads; o.setOrientation( eulerToMat(ax,ay,az) ) but this does not produces really wacky rotation in Blender, when the object in jitter is spinning slowly the one in Blender is speding up and slowing down. If anyone whos knows a bit about maths can help me out id be really thankful. Even just telling me what jit.gl.handles roatation numbers actually are would help. Cheers. 

Oct 26, 2006 at 7:50pm
On Oct 26, 2006, at 11:23 AM, will wrote: > I need to convert these numbers into a format Blender will
As is typical in OpenGL, the rotation is specified in angle/axis // convert angle/axis rotation to quaternion. mag = Math.sqrt(axis[1]*axis[1] + axis[2]*axis[2] + axis[3]*axis[3]); if (mag < 0.0005) scale = Math.sin(phi/2.0)/mag; quat[0] = axis[1]*scale; this.quat_to_axis = function (quat,axis) if (Math.abs(sin_a) < 0.00005) axis[1] = quat[0] / sin_a; Joshua 

Oct 26, 2006 at 10:33pm
Hi Joshua, Thanks for the help, everythings up and running now. If anyones interested heres some equations. And importantly if youre using python then unlike opengl everythings in radians not degrees had me stumped for a while. http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToMatrix/index.htm http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm 
You must be logged in to reply to this topic.