How do I play an animation using lib3ds?

I am having trouble playing an animation of a .3ds object using lib3ds.

I am able to load the .3ds model with lib3ds. But I can't find a way to play (for example) my 'walk' animation. Where can I find the animation data and how can I play the animation using lib3ds?

• I don't know how lib3ds but in version 1.3 there is an example folder with the file named 3dsplay.c . It's not a tutorial, just code, but apparently it shows how to play an animation. – Sidar Feb 14 '13 at 16:23
• Just wondering, I edited the post. Why does it say @Sam Hocevar did it? His "edit" didn't change my changes to the original post. Just curious. How does it work? – Sidar Feb 14 '13 at 16:36
• @Sidar I approved your edit and further removed the signature at the bottom of the post, so it's that second edit that appears. You can still see yours in the history. – sam hocevar Feb 14 '13 at 17:04
• @SamHocevar ah yes, missed that. – Sidar Feb 14 '13 at 17:30

lib3ds only provides access to the data within .3ds files, along with some utility functions. It does not appear to have any kind of built-in playback functionality. You will need to build that yourself, but to do so you will need to access the data that lib3ds has loaded up.

lib3ds exposes Lib3dsTrack objects for various nodes in the file which define keyframe tracks for various attributes of the node.

You are probably interested in the tracks of Lib3dsMeshInstanceNode, which are:

Lib3dsTrack pos_track;
Lib3dsTrack rot_track;
Lib3dsTrack scl_track;
Lib3dsTrack hide_track;


These tracks define keyframes for position, rotation, scale, and visibility of the mesh. The keyframes are of type Lib3dsKey and contain value information as well as flags indicating which type of value information to use for that key (not all keys have sane values in all value fields).

There are various utility functions (in the track_eval_* family) that allow you to evaluate the value of some specified track at some specified time t, which can help you in processing the data in the tracks so you don't have to do it all yourself.