Just a note on animations:
I export the character model without any animations. Select the armature, set the TimeLine to 0, go into the Dope Sheet->Action Editor and hit "x" to disable/deselect the current action, in armature Properties->Object Data put it in the Rest Position, then from the Viewport select Pose Mode, select all bones, in Pose tab Apply->Apply Visual Transform To Pose, back to the Properties->Object Data and deseclt Rest Position by pressing Pose Position button, and then select all objects that I want exporting and export. This way the character model exports without an ambient animation.
For export you only need selected the base01-start01-armature-bounds, no meshes, no LODs.
For each animation, I select it in the Dope Sheet->Action Editor. In the Timeline select the start and end frames - this is new to Blender 2.8 and it will either cut off your animation if it is too short or add empty frames if too long.
NOTE: keyframe 0 is the Rest Position, so animations start at 1. This helps with transforms, especially for blend animations. For a blend animation the root pose is 2, and the blend animation starts at 3.
For cyclic animations like run, 0 is the Rest Position, 1 is the start of the loop animation and the last frame is a copy of this. In tsShapeConstructor the start and end frames are selected, so for looping animations the end frame is the last minus 1.
So ehre's what the tsShapeConstructor looks like; note animations start at 1, thus missing the Rest Pose to help transforms, blends start at 2 to miss Rest Pose and Root pose reference, looping animations end at the frame before they finish so not to replay it, all other animations end at -1, the finish.
There are no Death, Head, Headside, or Look animations because this is set up for a topdown character who only shoots forwards.
singleton TSShapeConstructor(GunGirlPlayerDae)
{
baseShape = "./gunGirlPlayer.dae";
lodType = "TrailingNumber";
loadLights = "0";
};
function GunGirlPlayerDae::onLoad(%this)
{
%this.addSequence("./anims/gunGirlPlayer_landx.dae", "land", "1", "-1", "1", "0");
%this.setSequenceCyclic("land", "0");
%this.setSequencePriority("Land", "0");
%this.addSequence("./anims/gunGirlPlayer_fallx.dae", "fall", "1", "-1", "1", "0");
%this.setSequencePriority("Fall", "1");
%this.addSequence("./anims/gunGirlPlayer_sprint_backwardx.dae", "sprint_backward", "1", "24", "1", "0");
%this.setSequencePriority("sprint_backward", "2");
%this.addSequence("./anims/gunGirlPlayer_sprint_left_sidex.dae", "sprint_side", "1", "24", "1", "0");
%this.setSequencePriority("sprint_side", "3");
%this.addSequence("./anims/gunGirlPlayer_sprint_right_sidex.dae", "sprint_right", "1", "24", "1", "0");
%this.setSequencePriority("sprint_right", "4");
%this.addSequence("./anims/gunGirlPlayer_sprint_forwardx_static.dae", "sprint_forward", "1", "16", "1", "0");
%this.setSequencePriority("sprint_forward", "5");
%this.addSequence("./anims/gunGirlPlayer_backx.dae", "back", "1", "98", "1", "0");
%this.setSequencePriority("Back", "6");
%this.addSequence("./anims/gunGirlPlayer_side_leftx.dae", "side", "1", "50", "1", "0");
%this.setSequencePriority("Side", "7");
%this.addSequence("./anims/gunGirlPlayer_side_rightx.dae", "side_right", "1", "50", "1", "0");
%this.setSequencePriority("Side_Right", "8");
%this.addSequence("./anims/gunGirlPlayer_runx.dae", "run", "1", "98", "1", "0");
%this.setSequencePriority("Run", "9");
%this.addSequence("./anims/gunGirlPlayer_rootBase.dae", "root", "1", "60", "1", "0");
%this.setSequencePriority("root", "10");
%this.addSequence("./anims/gunGirlPlayer_heavy_recoilx.dae", "heavy_recoil", "2", "-1", "1", "0");
%this.setSequenceCyclic("heavy_recoil", "0");
%this.setSequencePriority("heavy_recoil", "11");
%this.setSequenceBlend("heavy_recoil", "1", "root", "0");
%this.addSequence("./anims/gunGirlPlayer_medium_recoilx.dae", "medium_recoil", "2", "-1", "1", "0");
%this.setSequenceCyclic("medium_recoil", "0");
%this.setSequencePriority("medium_recoil", "12");
%this.setSequenceBlend("medium_recoil", "1", "root", "0");
%this.addSequence("./anims/gunGirlPlayer_light_recoilx.dae", "light_recoil", "2", "-1", "1", "0");
%this.setSequenceCyclic("light_recoil", "0");
%this.setSequencePriority("light_recoil", "13");
%this.setSequenceBlend("light_recoil", "1", "root", "0");
}
Now note I use sequencePriorities just to make sure things don't have to think too much about what should be playing. These are based on what the engine would expect to play in order. eg: if Land comes before Fall because if you have landed you are no longer falling, etc
0 Death, Land, Head, Headside, Look
1 Fall
2 Jump
3 Crouch_Back
4 Crouch_Side
5 Crouch_Right
6 Crouch_Forward
7 Crouch_Root
8 Sprinting_Back
9 Sprinting_Side
10 Sprinting_Right
11 Sprinting_Forward
12 (Standing_)Back
13 (Standing_)Side
14 (Standing_)Right
15 (Standing_)Run
16 (Standing_)Root
17 Light_Recoil
18 Medium_Recoil
19 Heavy_Recoil
20+ Others after this...
So why export animations seperately?
If you export a single ambient animation, either on it's own, or with the character model, Torque has to load the entire animation EVERY TIME you want to add or modify a single animation and this takes time, even on my i7 there are seconds of twiddling thumbs while it loads it EVERY TIME. By having smaller, more numerous animations it's over in an instant, and you barely see the "loading collada animation" popup.
Secondly, if you have seperate animations you can reuse them for other character which have the same armature set up rather than loading the same files over and over again.
Hopefully this helps and isn't too complicated.
