confused about orientation.

I don’t understand orientation at all. “own.orientaton” returns three lists that make no sense to me. how can I reverse direction? whats north, whats west? WTF!

Actually, it returns a Matrix.

To really understand the mathematical details, you can study linear algebra (there’s plenty resources on the web). For a cursory introduction, you can watch this video tutorial: http://www.youtube.com/watch?v=hyxS4RyWxpk#t=2m33s

As Goran says, it’s an orientation matrix. If you multiply a unit vector (eg [0,1,0] for y axis) by it, you end up with the global vector for which way the y axis is facing.

Probably what you’re looking for is:

simple_ori = own.worldOrientation.to_euler()

(Don’t use .orientation, it’s deprecated)
And you can always write to it with traditional x,y,z:

own.worldOrientation = [0,0,0]

But if you just want to turn it around, you can simply apply a rotation to it:


import math
own.dRot = [0,0,math.pi]

dRot is delta-rotation, or, how much you want the rotation to change by. Be aware that changing the rotation like this is instant, and can seem unrealistic.

play with the cube to see in real time how work matrices, not be care to the full matrices , just follow one axis-vector.
when understand it you have underststand how work matrices
(see blend for control):wink:MatrixHelper.blend

PS: obj.orientation(should be deleted) can add confusion since write local and read global.

Wow, MarcoIT, the particles are great! (sorry, off-topic)

thanks Raco! :smiley:

Dear MarcoIT
your great file makes me regret the time I spent playing football when I was young instead of learning mathematics!
Thank you for sharing!
Bye

Hi OTO , i open a TD 2 years ago asking help for matrices (these strange buch of numbers that still so also now anyway)
i starting to understand with some tips but overall seeing a blend of Goran :wink: