Skip to main content
GameDev.net gamedev.net
🔒 Locked

2D Articulated Animation

Started by gabrielauditore Jan 15, 2012 at 5:33 AM 3 replies 1.6k views
Original Post
gabrielauditore
gabrielauditore
Hey guys, does anyone know a good book / tutirial on how to make a 2d artuculated animation system?
I know it's avague question, but google turned up only graage results...
The Magical Pot
The Magical Pot
Please tell us what language you what to do it in, I'm assuming that you what to do an animation in your game engine. If you are using C++ and SDL, then this tutorial might help you: http://lazyfoo.net/SDL_tutorials/lesson20/index.php, although you might have to look at some earlier tutorials depending on how much you know about the programming used in that tutorial.

If you are not using C++ and SDL, then I can tell you that the concept of that tutorial is that you have one big PNG file for a given object within the game. Every frame that you want to show is in that PNG file, then you clip the image into smaller images. When you want to show that object within the engine, you loop the different frames.
Let's say that you want to animate a flower, the flower has a width and height and you use those numbers to clip your image into smaller ones. You then assign a number to the frames in the form of a variable array. When you show the flower, you have to keep track of what frame it is on, how fast it should change frame and when to loop the animation and start on frame 1.

The reason that you clip your image into individual frames instead of having the frames in individual files is simply to minimize the amount of code that you have to write.

I hope this can help you.
gabrielauditore
gabrielauditore
Hi, The Magical Pot

Thanks for the reply. I already have a pretty solid frame-based animation system in place. I'm looking for something that is articulated that is something with a skeleton and a hierarchy. The only tutorials i've been able to find are about 3D articulated animation, but i'd like to not use matrices. As far as programming language i'm working with C++ and rendering trough OpenGL, but the tutorial language doesn't matter, if there is something in javascript, ruby, c#, etc... i'll understand the code and be able to apply it.

Thanks guys
wolfscaptain
wolfscaptain
There is no difference between 2d and 3d skeletal animation.

You never have to use matrices (in fact I think you should not, for interpolation reasons), as long as you can make the world matrix for each bone at the end.
gabrielauditore
gabrielauditore
wolfscaptain,

Thanks for the reply that actually helped clear things up a lot.
There is one last piece of this puzzle that i'm still not fully grasping.

How could i go about setting an arbitrary rotation center for each node?
At this point i think i would actually need two matrices, one to be the generic transform and one to be the offset rotation... I can't really figure this one out.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.