I have written an exporter for blender to use with my games, including hierarchical object data and animation curves. So far, I have only had a need to work with a subset of animation channels - either just translations or just a single rotation axis (eg., just rotation around X axis).

But now for a new game, I need to include all channels from LocRot keyframes - X,Y,Z location, and Euler rotations X, Y, and Z.

I searched around, but so far have been unable to find the answer to my question: In what order do I apply the channels to generate the transformation matrix? Do I apply translation first, then rotate around X, then rotate around Y, and finally rotate around Z?

Thanks very much!

  • 1
    $\begingroup$ Instead of using fcurves could set frame scene.frame_set(f) and export ob.location and ob.rotation_euler for each frame. $\endgroup$
    – batFINGER
    Feb 10, 2020 at 13:47

1 Answer 1


Found the answer on this page:


So, basically, compute the 3x3 rotation matrix using the formula on that page, and then add the translation coefficients to make it a 4x4 matrix.

Rotation matrix = Rz(φ)Ry(θ)Rx(ψ):
cosθcosφ, sinψsinθcosφ−cosψsinφ, cosψsinθcosφ+sinψsinφ, 
cosθsinφ, sinψsinθsinφ+cosψcosφ, cosψsinθsinφ−sinψcosφ,
−sinθ, sinψcosθ, cosψcosθ

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .