New example split_long_md3_animation_into_logical_pieces shows how to play subanimations in MD3 files. In a broader context, it shows how to use
TCastleSceneCore.ForceAnimationPose to manually “drive” the animation, picking the animation frames you want.
The MD3 format comes from Quake 3 and it’s used by various games sharing that game engine. In particular I’m a big fan of Tremulous so this example naturally shows Tremulous cool low-poly aliens rendered and animated using Castle Game Engine 🙂
The MD3 file itself doesn’t specify particular animations, it is essentially one long animation that in practice usually contains glued a number of “subanimations” in our terminology. The accompanying
animation.cfg specifies the “subanimations”, where do they start and finish. The example code defined a ready class that loads
animation.cfg, and allows to query and easily play “subanimations” specified there.
If you use MD3 files with accompanying
animation.cfg files, you will find the class
TSceneSubAnimations to be a ready-to-use component that allows you to deal with MD3 animations easily.
If you’re looking into more general “how can I manually control the animation” then look under the hood and see how is the
TCastleSceneCore.ForceAnimationPose used there.
Here’s a quick demo: