In this recipe, we're going to use SceneComposer to create subanimations. As the name implies, they're derived from an animation. Subanimations can be a good way to squeeze some extra out of stock models that don't have the exact animations you want, or if the modeler has gone home for the day. In this particular application, we'll prepare for the next recipe, which is about lip syncing. The Extract sub animation window in SDK looks, as shown in the following screenshot:
The biggest caveat when creating subanimations is that the jMonkeyEngine API uses relative time when interacting with models, while subanimations are created on a frame basis. So, the easiest way to find out which frames to extract is to open the model in an external editor and look at it in parallel.
Extracting a subanimation can be done by performing the following steps:
An animation in jMonkeyEngine consists of a number of BoneTracks
. Each of these has an array of floats with the times for the animations, an array of Vector3f
with the positions of the bones, array of Quaternions with rotations, and another array of Vector3f's
with scales. Each instance of the arrays contains information about a frame.
A subanimation is a copy of an excerpt from all the BoneTracks
in the parent animation.
3.143.239.44