Animation binary file editing. A Tutorial
For now, I'll explain the process of making S2U animated mebs work in the pCars environment. If you're animating a meb from scratch, there's an additional layer of complexity, due to creating skeleton/bones and weight painting vertices for bone affection. However, this guide as to how to edit the animation *.bas file applies for both S2U converted mebs and scratch made animated mebs.
Step 1) the animation *.bas to be chosen is based upon which car will be providing the donor wiper animation as that is most important.
Step 2) Open the cockpit *.bas and review the items available for animating. There will be times that not every animated meb you have will be in the donor *.bas. So, you'll be limited to only animating the options available in donor cockpit *.bas
NOTE: the *.bas is formatted with containers for each animated element. It seems possible to add new elements to the file, but there is a convoluted chaining in place between each element to solve (portions of chain are easy to follow, while some of the chaining is odd). Also, a different configanim.bin would be required that includes any new elements you are attempting to add.
Step 3) Compare the Root and bone names in the code of your animated mebs against those in the code of the donor cockpit *.bas file. If there is a mismatch and the character length is the same, edit the root and/or bone names to match the *.bas file. If there is a mismatch and the character length is different, import the animated mebs into Zmodeler, change the root and/or bone names, then export.
Restore all missing data sections and do typical fill patterns on any exported mebs from Zmodeler.
Step 4) Review the attached image of highlighted code.
For the S2U animation BAS, you have a transform data entry for your bone/root...
Code:
<NODE name="cockpit_kit00_BONNET" mirror="cockpit_kit00_BONNET">
<!-- 0.00000050 0.20636831 0.97847438 0.00000000 -->
<!-- -1.00000000 0.00000031 0.00000044 0.00000000 -->
<!-- -0.00000021 -0.97847438 0.20636831 0.00000000 -->
<!-- -0.00000004 0.81309271 -1.67113531 1.00000000 -->
<TRANSFORM data="3505F37F 3E535237 3F7A7D4C 00000000 BF800000 34A7349F 34EE87EB 00000000 B464C324 BF7A7D4C 3E535237 00000000 B33AEA93 3F5026D8 BFD5E7C3 3F800000 " />
</NODE>
Convert the 16 "Transform" words to little endian, then enter in order into the code highlighted in blu-ish color. You enter the values in order as if you were reading the Transform data entry left to right.
Note: the above code is reference only, does not reflect actual data in the attached pic.
Step 5) (bone or root orientation values) Import animated meb into Zmodeler. Unlink Root and bone from skeleton. Convert root and bone to dummy. Add suffix of "_cpit" to names of root and bone in node browser. Export as "CarName_cockpit.vhf.bml" to a temporary folder. Open the XML generated by zmodeler. Locate the bone name and copy out the 4 values for Orientation.
Example...
Code:
Orientation="-0.009315 -0.997149 0.035250 0.066149"
Orientation=" Value 1, Value 2, Value 3, Value 4"
Note: the above code is reference only, does not reflect actual data in the attached pic.
Convert all values to floating point hex in little endian....
Code:
Value 1 = F19D18BC
Value 2 = 28457FBF
Value 3 = 4E62103D
Value 4 = 2079873D
Note: the above code is reference only, does not reflect actual data in the attached pic.
Back to the attached picture. For the code marked in green, enter the values in this order... Value 4, Value 1, Value 2, Value 3
Notice how the data is entered out of sequence. Be careful not to mix things up.
Step 6) (bone or root offset values) Back to the attached picture. For the code marked in Red, simply copy the 13th, 14th and 15th values (words) of the Transform data (highlighted in blue) and paste that in following the same order.
Other notes: I also changed all code in the "Root" element to match the S2U *.bas file, too.