Hey everyone.
I’m currently writing a collada parser of sorts, and I’m a bit lost at the moment. I have relatively little linear algebra experience so I don’t know exactly what the transformation matrix means in the file.
If I have a source in an animation that looks like this:
<float_array id="pelvis-Matrix-animation-output-transform-array" count="496">
1.000000 -0.000000 0.000000 0.000000 0.000000 1.000000 -0.000000 48.628288 -0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000
0.999992 0.004042 0.000000 -0.000000 -0.004042 0.999992 -0.000000 47.746246 -0.000000 -0.000000 1.000000 -0.000000 0.000000 0.000000 0.000000 1.000000
0.999889 0.014871 0.000000 -0.000000 -0.014871 0.999889 -0.000000 45.541759 -0.000000 -0.000000 1.000000 -0.000000 0.000000 0.000000 0.000000 1.000000
0.999533 0.030542 0.000000 -0.000000 -0.030542 0.999533 -0.000000 42.676380 -0.000000 -0.000000 1.000000 -0.000000 0.000000 0.000000 0.000000 1.000000
0.998793 0.049110 0.000000 -0.000000 -0.049110 0.998793 -0.000000 39.810997 -0.000000 -0.000000 1.000000 -0.000000 0.000000 0.000000 0.000000 1.000000
0.997642 0.068628 0.000000 -0.000000 -0.068628 0.997642 -0.000000 37.606514 -0.000000 -0.000000 1.000000 -0.000000 0.000000 0.000000 0.000000 1.000000
0.996195 0.087156 0.000000 -0.000000 -0.087156 0.996195 -0.000000 36.724472 -0.000000 -0.000000 1.000000 -0.000001 0.000000 0.000000 0.000000 1.000000
0.993877 0.110493 0.000000 -0.000000 -0.110493 0.993877 -0.000000 44.013634 -0.000000 -0.000000 1.000000 -0.000000 0.000000 0.000000 0.000000 1.000000
0.990268 0.139171 0.000000 0.000000 -0.139171 0.990268 -0.000000 58.109203 -0.000000 -0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000
0.986555 0.163430 0.000000 0.000000 -0.163430 0.986555 -0.000000 67.364952 -0.000000 -0.000000 1.000000 0.000001 0.000000 0.000000 0.000000 1.000000
0.984808 0.173648 0.000000 0.000000 -0.173648 0.984808 -0.000000 69.155594 -0.000000 -0.000000 1.000000 0.000001 0.000000 0.000000 0.000000 1.000000
0.991086 0.133221 0.000000 0.000000 -0.133221 0.991086 -0.000000 69.471336 -0.000000 -0.000000 1.000000 0.000001 0.000000 0.000000 0.000000 1.000000
0.999048 0.043619 0.000000 0.000000 -0.043619 0.999048 -0.000000 69.392975 -0.000000 -0.000000 1.000000 0.000001 0.000000 0.000000 0.000000 1.000000
0.998926 -0.046335 0.000000 0.000000 0.046335 0.998926 -0.000000 69.017708 -0.000000 0.000000 1.000000 0.000001 0.000000 0.000000 0.000000 1.000000
0.996195 -0.087156 0.000000 0.000000 0.087156 0.996195 -0.000000 68.134964 -0.000000 0.000000 1.000000 0.000001 0.000000 0.000000 0.000000 1.000000
0.997291 -0.073562 0.000000 0.000000 0.073562 0.997291 -0.000000 62.673626 -0.000000 0.000000 1.000000 0.000001 0.000000 0.000000 0.000000 1.000000
0.999048 -0.043619 0.000000 0.000000 0.043619 0.999048 -0.000000 53.797279 -0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000
0.999907 -0.013638 0.000000 0.000000 0.013638 0.999907 -0.000000 49.140327 -0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000
1.000000 -0.000000 0.000000 0.000000 0.000000 1.000000 -0.000000 50.852619 -0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000
1.000000 -0.000000 0.000000 0.000000 0.000000 1.000000 -0.000000 54.031849 -0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000
1.000000 -0.000000 0.000000 0.000000 0.000000 1.000000 -0.000000 55.744141 -0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000
1.000000 -0.000000 0.000000 0.000000 0.000000 1.000000 -0.000000 55.003895 -0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000
1.000000 -0.000000 0.000000 0.000000 0.000000 1.000000 -0.000000 53.239212 -0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000
1.000000 -0.000000 0.000000 0.000000 0.000000 1.000000 -0.000000 51.133217 -0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000
1.000000 -0.000000 0.000000 0.000000 0.000000 1.000000 -0.000000 49.368534 -0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000
1.000000 -0.000000 0.000000 0.000000 0.000000 1.000000 -0.000000 48.628288 -0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000
1.000000 -0.000000 0.000000 0.000000 0.000000 1.000000 -0.000000 48.628288 -0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000
1.000000 -0.000000 0.000000 0.000000 0.000000 1.000000 -0.000000 48.628288 -0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000
1.000000 -0.000000 0.000000 0.000000 0.000000 1.000000 -0.000000 48.628288 -0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000
1.000000 -0.000000 0.000000 0.000000 0.000000 1.000000 -0.000000 48.628288 -0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000
1.000000 -0.000000 0.000000 0.000000 0.000000 1.000000 -0.000000 48.628288 -0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000</float_array>
I want to figure out how to pull position, size, and rotation out of that for each frame. As far as I understand, each line above is a separate transformation matrix. I have found some instructions on how to get that information out of a 2D (9 element) transformation array, but not a 3D one. The collada file is in fact 3D, but it has no changes on the Z dimension, and is a bunch of flat billboards. It looks like the 4th row elements above aren’t all 0, which I was hoping they would be.
Can anyone point me in the right direction, or even tell me what to do here? For convenience, the topmost matrix listed would be:
1 0 0 0
0 1 0 48
0 0 1 0
0 0 0 1