Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question
    
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

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.