A "track" is a numbered placeholder for a track entry. A track entry stores information about an animation, such as which animation, if it should loop, what track entry to play when it is done, etc. Every frame, the animation for each track is applied one after another, lowest track number to highest. By applying multiple animations each frame, you can eg have a shoot animation that is played on top of idle, walk, run, swim, etc.
When an animation is applied, it only changes the skeleton properties that are keyed in the animation. Usually track 0 applies an animation that keys all the bones, eg walk, run, jump. Subsequent tracks usually key only a subset of bones, eg shoot, facial expression, etc. A subsequent track can key the same bones however, eg run on track 0 keys the arms and shoot on track 1 keys the arms. In this case the arms pose from run is overwritten by shoot. Also, a track entry has a "mix" property which is what percentage of previous tracks are preserved when the track is applied.
The animation for a track is set with setAnimation
, which replaces the current track entry and returns the new track entry which can be configured further. Animations can be queued to be played after a delay with addAnimation
, which also returns the new track entry. The delay is often the duration of the previous animation, but doesn't have to be.