TransWikia.com

F-curves: Generating transformation matrix

Blender Asked on December 4, 2021

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!

One Answer

Found the answer on this page:

https://www.gregslabaugh.net/publications/euler.pdf

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θ

Answered by Jamie on December 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP