Rotation Matrix to xyz help

Does anyone know of a script that converts a 3*3 matrix into xyz rotation? I have been trying to figure this out forever.

Thanks

I think the toEuler() function in Blender.Mathutils.Matrix should be what you’re looking for.

so how does this work… like orientation.toEuler() because when I do that I get an error. Also, will this work in the ge?

What is this “orientation”? And what is the error? toEuler() needs a matrix object as input, as said in the documentation. Is “orientation” a matrix object? What do you want to do? What did you do so far?

I don’t know if this works in the game engine, I’m not too versed in game engine Python, the API docs I linked to are for the Blender Python API. Here is a link to the game engine Python docs.

Generally for questions about game engine scripting you might get better help if you to ask in the game engine subforums.

EDIT: After thinking, I figured that “orientation” is your game engine orientation matrix you get from the function getOrientation(), yes? If so, the toEuler() function won’t work, because it’s from the Blender Python API, not from the GE Python API. But I can still help a bit: I remember a nice tutorial about matrices in the GE by people who made a racing game. You can get it here: Blender’s Orientation Matrix. It may not be up to date with all the recent changes in the GE, but hopefully it will still help you.

I used a BezTriple quite heavily in my code, which I use to pass an XYZ to the IPO window.

But basically, you don’t even really need much of a script, and can you detail more on what your 3x3 matrix will contain?
Mainly because with a 3x3 matrix you can store 3 times more data than just simple XYZ