setorientation and axis

Hi all !

i need some help to understand the “setOrientation”

I want ‘cube’ to have the same Z axis orientation than ‘armature’

cube_o = cube.getOrientation()
armature_o = armature.getOrientation()

cube.setOrientation ( [ [X,X,X] , [X,X,X] , [X,X,X] ] )

Where do i put the ‘cube_o[X][X]’ and the ‘armature[X][X]’ in the code ?
i test some kind of possibility, but no success :frowning:

thx for help :wink:

Try this:

cube.setOrientation = ([cube_o[0],cube_o[1],armature_o[2]])

I’m not sure if it will work, but it would make sense.

This will not work.

The rotation is the result of the multiply of some matrices. For rotation around one axis 4 of the 9 parameters are changed:

Rx = [1,0,0][0,cos(a),sin(a)][0,-sin(a),cos(a)]
Ry = [1,0,0][0,cos(b),sin(b)][0,-sin(b),cos(b)]
Rz = [cos©,sin©,0][-sin©,cos©,0][0,0,1]

You get your rotation (orientation) matrix by multiplying each matrix RxRyRz (which is not the same as RzRyRx!).

what is the a, b , c ? degree rotation ?

is it a way to just use ‘armature_o[X][X]’ ?

cube_o = RxRyRz ?
difficult to understand :frowning:
:confused:

I wish you could control rotation a lot easier from Python, matricies are a nightmare.

Yeah… matrices ARE a nightmare… but… they exist for a good reason I guess (I’m studying these transformation matrices riight now as we speak)…

anyways… take a look at this link:
http://blenderartists.org/forum/showthread.php?t=47149

it might help you out…

ok i find another way than matrix.

but thx :slight_smile: