gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > MD2 animation

#68140 - iainprice - Sun Jan 22, 2006 8:04 pm

I know there have been a lot of threads about MD2...

I can create a program that loads and manipulates MD2 files with multiple textures blah blah blah...but I'm not sure how to access the different frames of animation within an MD2 file.


Are there any open source examples out there or anyone willing to send a bit of time suggesting a nice neat way to me.

Thanks.

#68345 - dovoto - Mon Jan 23, 2006 10:32 pm

Quake 2 Expects the frames to be in a single array of 198 frames arranged in a very specific order. If you are creating models for your own use in your own engine this is not important but if you are either creating Quake compatible MD2 models or attempting to extract animation data from MD2 models then this must be kept in mind.

For the complete breakdown of all 198 frames and what point in the animation they represent check http://www.planetquake.com/polycount/resources/quake2/q2frameslist.shtml

As for the mechanics of the animation (in case that was really your question) there are two ways to go about it...

Assume you want a 15fps animation...You can hold the animation frame constant for 4 frames and then switch to the next frame. This works and on the DS might even look okay.

Or you can load both the current frame and the next frame and interpelate between them based on which "inbetween" frame you are on....Just take the difference in vertex locations between the two frames and move closer to the second frame as time goes by. This results in much smoother animation.
_________________
www.drunkencoders.com