I’m writing a short script that affects the movement of an object subject to its current rotation on x axis. I just can’t seem to find a way to get that information. “getOrientation” sounds like it would do but it insists that the x axis is unchanged, yet that is the only one affected by the script. Can anyone Help?

Hi

I managed to the plane xy-attitude with this

```
def getOrientationAxes(ob): # 'ob' is a object name
ori=ob.getOrientation()
x=ori[0]
y=ori[1]
z=ori[2]
neworiX=[x[0],-x[1],-x[2]]
neworiY=[-y[0],y[1],-y[2]]
neworiZ=[-z[0],-z[1],z[2]]
return [neworiX,neworiY,neworiZ]
a_r = round(degrees(acos(getOrientationAxes(Cube)[2][0])),0) # roll
a_p = round(degrees(acos(getOrientationAxes(Cube)[2][1])),0)-90 # pitch
```

getOrientation() returns a matrix. Social wrote a tutorial on the orientation matrix on his website, a link might be in his sig.

Thanks Xjazz. I’ve put that in but get a “name ‘degrees’ is not defined” error from the “a_r=…” line. I’ve imported math module which obviously doesn’t help so I’ll have to dig a bit deeper. But thanks to you I’m a lot closer. I also found some old discussion here

FYI I’m playing with ragdoll physics in an attempt to generate fluid ipos as in NaturalMotions Endorphin

Thanks again

Thanks Xjazz. I don’t know what happened but my earlier reply to you seemed to disappear (still trying to learn how to work these discussion groups). I put your code in but got a “name ‘degrees’ is not defined” error in the terminal. But you’ve put me a step closer to sorting this. I’m intrigued that getting the attitude of an object in degrees is so difficult and not being a mathematician dealing with eulers and radians is doing my head in. If you’re interested I found some old discussion here on the topic. Now to sort out this error. Thanks again

Thanks Andrew-101 but I couldn’t track this down - no site in his sig but I found an old tut on FPS which looks worth following up

Hmm, so its not. I myself couldn’t understand the matrix.

Edit, I now need to learn the matrix so I found a tutorial from 2 years ago, download works though.

http://blenderartists.org/forum/showthread.php?t=70111

Thanks but, again I’m stymied - the link (in the thread) is dead. Xjazz’s code snippet above has done it for me though. Pity, it would be good to get more background on this issue…

Ok, well if you still want it I found socials tutorial:

http://socialstorage.googlepages.com/orientationmatrix-basics

Brilliant, Thanks