Loading 3ds Keyframes from Blender

3ds files can also be used for building an animation. In this view I have rigged the man from the previous tutorial and done a walk animation. Although there are 5 key frames in the walk animation in Blender, the last and first are the same so only four are necessary. The key frames are exported one at a time by clicking on the keyframe and then selecting the model rather than the skeleton and exporting the same way. I named these walk1- walk4.

In the code below an animation sequence is added to the object and there is a new function called doAnim() which moves the key frames. The indexes for the animation really start at one, since a zero is a combination of all sequences. Here the animation is set for walk (2); I started loading the animation walk sequence at walk2 because it matches an idle better for a smoother transition from idle to walk.

Note for jPCT-AE users

The basic idea for doing this in jPCT-AE is exactly the same. However, you must not call build() on the object that should get the animation assigned to it before actually adding the animation or the result will become static. The same applies to desktop jPCT when using compiled objects. In that case, use callBoundingBox(); calcNormals(); instead of build() and call build() only after the animation has been assigned.