Well I have to start learning somewhere, so I wrote an extractor
to pull the cas's out of pack.dat using the offsets in the index file.
Pulled out 30 to look at. The first 5 bytes are the header where
the first short is the number of anim frames. The other 3 bytes are
14 00 14 hex or 20 0 20. The only question is what comes first,
quaternions or pose data. I saw some 0.0 0.0 0.0 1.0 values so that
answered two things: quats come first and CA uses the {q1, q2, q3, q4}
convention where q4 is the special one. I transformed them to Euler
angle using the 321 convention and got this for the first anim frame
for CR_spear_charge.cas:
Code:
Number of animation frames: 11
Remaining header: 20 0 20
Quaternion data and maybe Euler angles (using 321)?
q1 q2 q3 q4 sum of squares yaw (deg) pitch (deg) roll (deg)
============ anim quaternion frame 0 ============
+0.2538955510 +0.1681092978 -0.0226481762 +0.9522412419 sum squs = +1.0000000095 +2.5657103993 +19.3696683429 +30.2967888994
-0.3953365684 -0.0070954142 +0.1987117827 +0.8967565298 sum squs = +0.9999999935 +21.4590405866 +8.3019773363 -46.0049588155
+0.1825654358 +0.0634186864 +0.0113932779 +0.9810800552 sum squs = +0.9999999497 +2.6276101260 +6.9081227284 +21.2413852449
+0.0005502258 +0.0181907974 -0.2293124646 +0.9731827378 sum squs = +1.0000000555 -26.5251008404 +2.0435025817 -0.4169129706
+0.0379701219 +0.0379873700 -0.0190575924 +0.9983747005 sum squs = +1.0000000050 -2.0214710134 +4.4332999853 +4.2777858328
+0.1421776563 +0.1788186878 +0.0416587740 +0.9726633430 sum squs = +1.0000000412 +8.0495681889 +19.6342635762 +18.0275697089
-0.2416000813 -0.3342688680 +0.0259645525 +0.9106149077 sum squs = +0.9999999436 +15.0756420060 -36.6006764153 -34.7298720077
+0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000 sum squs = +1.0000000000 +0.0000000000 +0.0000000000 +0.0000000000
+0.0000000000 +0.0000000000 +0.0000000000 +1.0000000000 sum squs = +1.0000000000 +0.0000000000 +0.0000000000 +0.0000000000
-0.0013705824 -0.0047476389 -0.0055176513 +0.9999725819 sum squs = +1.0000000275 -0.6315546125 -0.5448992324 -0.1540581944
-0.0002179843 -0.0194163416 -0.3695584238 +0.9290046096 sum squs = +1.0000000350 -43.3998593387 -2.0766736500 +0.7995938917
-0.0381897017 -0.6430811286 -0.0234443955 +0.7644858360 sum squs = +1.0000000244 +4.4177386253 -80.0780864235 -9.4322343545
+0.0172815081 +0.1676424295 -0.1667936444 +0.9714819789 sum squs = +0.9999999898 -19.7157479464 +19.3591213839 -1.3571896291
-0.0011378765 +0.0047027008 +0.0202233475 +0.9997837543 sum squs = +0.9999999494 +2.3170456268 +0.5414182810 -0.1194701201
-0.2264718562 -0.1660457850 +0.4406757355 +0.8526102304 sum squs = +1.0000000133 +56.0534307300 -4.7922679610 -32.3030476656
-0.0418538116 +0.8028841019 +0.0247014631 +0.5941508412 sum squs = +1.0000000070 +7.4251721953 +72.9670051832 +1.9701113044
+0.0022718122 +0.0688987225 +0.0323999561 +0.9970948100 sum squs = +1.0000000124 +3.7581457004 +7.8887411361 +0.5203097663
-0.3605583012 -0.4344316721 -0.1733115017 +0.8069881797 sum squs = +0.9999999651 +3.4140766971 -55.7042659859 -49.9541032693
+0.2243260294 +0.1274575591 +0.0513146892 +0.9647793770 sum squs = +1.0000000404 +9.2202763455 +12.8802680946 +27.2221190368
-0.0548719205 -0.0131644774 +0.1631041616 +0.9849938154 sum squs = +1.0000000151 +18.8304236382 -0.4603295875 -6.4533948925
============ anim quaternion frame 1 ============
The next block should be the position or pose data so its done as
triples:
Code:
Pose data:
================== anim pose frame 0 ============
+0.0000000000 +0.0000000000 +0.0000000000
+0.0952388272 +0.0007522855 -0.0000000016
+0.0225613043 -0.4644488990 +0.0143959904
+0.0241626762 -0.3995066285 -0.0316338763
-0.0000000072 +0.2124620080 +0.0000000010
-0.0002945314 +0.2115578204 +0.0000000317
-0.0000617032 +0.2349731475 +0.0000000667
+0.0003562687 +0.0108105456 -0.0034470414
+0.0016836965 +0.1178482845 -0.0744606182
+0.0132546313 +0.1300114095 -0.0273839347
+0.1653589308 -0.0517836995 +0.0034832763
+0.3022064567 +0.0111386590 -0.0137692019
+0.2838370204 -0.0030556649 +0.0263375491
-0.0102220755 +0.1300113946 -0.0273839198
-0.1678023189 -0.0517838039 +0.0034833569
-0.3021733761 +0.0111954454 -0.0144314468
-0.2838012874 -0.0032004488 +0.0267044865
-0.0952387974 +0.0007523632 +0.0000000220
-0.0216093566 -0.4641438425 +0.0230784863
-0.0250774939 -0.3986378312 -0.0406115353
================== anim pose frame 1 ============
This looks right because it matches the standard skeleton:
Code:
0.0 , 0.0 , 0.0
-0.095239 , 0.007520 , 0.0
-0.022561 , -0.464449 , 0.014396
-0.024163 , -0.399507 , -0.031634
0.0 , 0.212462 , 0.0
0.000295 , 0.211558 , 0.0
0.000062 , 0.234973 , 0.0
-0.000356 , 0.010810 , -0.003447
-0.001684 , 0.117848 , -0.074461
-0.013255 , 0.130011 , -0.027384
-0.165359 , -0.051784 , 0.003483
-0.302206 , 0.011139 , -0.013769
-0.283837 , -0.003056 , 0.026338
0.010222 , 0.130011 , -0.027384
0.167802 , -0.051784 , 0.003483
0.302173 , 0.011195 , -0.014431
0.283801 , -0.003200 , 0.026704
0.095239 , 0.000752 , 0.0
0.021609 , -0.464144 , 0.023078
0.025077 , -0.398638 , -0.040612
(Don't worry about the signs on the x values, The standard skeleton
was made to work with Milkshape so there's always to x -> -x transform
for that.)
So far, so good. The problem is I still have 76 floats left over that look like
this:
Code:
What the heck are these data:
We have 76 leftover floats
+0.0000000000 +0.0000000000 +0.0000000000
+0.0000000000 +0.0000000000 +0.0000000000
+0.0000000000 +0.0000000000 +0.0000000000
+0.0000000000 +0.0000000000 +0.0000000000
+0.0000000000 +0.0000000000 +0.0000000000
+0.0000000000 +0.0000000000 +0.0000000000
+0.0000000000 +0.0000000000 +0.0000000000
+0.0000000000 +0.0000000000 +0.0000000000
+0.0000000000 +0.0000000000 +0.0000000000
+0.0000000000 +0.0000000000 +0.0000000000
+0.0000000000 +0.0000000000 +0.0000000000
+0.0000000000 +0.0000000000 +0.0000000000
+0.0145724751 +0.0491957590 +0.0002147975
+0.0301976539 +0.1019454375 +0.0004450644
+0.0437174141 +0.1475874335 +0.0006442972
+0.0519736372 +0.1754599810 +0.0007659923
+0.0510471202 +0.1819434315 +0.0005802182
+0.0442738384 +0.1494659334 +0.0006524611
+0.0348668732 +0.0312059894 +0.0020629363
+0.0234865602 -0.0744927898 +0.0031001847
+0.0119119827 -0.0558995418 +0.0018968056
+0.0000000000 +0.0000000000 +0.0000000001
+0.5000000000 +0.0000000000 +0.0000000000
+0.0000000000 +0.0000000001 +0.0000000000
+0.0000000000 +0.0000000000 +0.0000000000
+0.0000000000
For a big 4.5 second animation like CR_spear_die_galloping.cas it's
worse, I have 556 floats left over, mostly zeroes or repeating values
but no idea what they are. The pose data on the last anim frame
still looks ok, I don't think I've slipped data by miscalculating the
frame offsets.
Another GrumpyOldMan question is this:
If I have my rotation matrix parametrized by the quaternions as
Code:
_ _
| |
| q1^2 - q2^2 - q3^2 + q4^2 2 * ( q1*q2 + q3*q4 ) 2 * ( q1*q3 - q2*q4 ) |
| |
| 2 * ( q1*q2 - q3*q4 ) -q1^2 + q2^2 - q3^2 + q4^2 2 * ( q2*q3 + q1*q4 ) |
R = | |
| 2 * ( q1*a3 + a2*q4 ) 2 * ( q2*q3 - q1*q4 ) -q1^2 - q2^2 + q3^2 + q4^2 |
| |
|_ _|
and similarly for Euler's
Code:
_ _
| |
| cos(psi) cos(theta) sin(psi) cos(theta) -sin(theta) |
| |
R = | - - cos(theta) sin(phi) |
| |
| - - cos(theta) cos(phi) |
|_ _|
is that Mete's convention or is it one of the other 11 sets?
Bookmarks