Jump to content
  • Advertisement
Sign in to follow this  
X Abstract X

Skeletal Animation Question

This topic is 3009 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm working on implementing a basic 2D skeletal animation system (To be upgraded to 3D at a later data). I briefly skimmed some resources and I noticed all of the Bone data structures have pointers to their children bones. I'm having a hard time seeing why this is necessary though. The way I see it is I can just create a bone by itself (no parent) or I can give it a pointer to a parent bone and then create it based on the parent's data. So basically, why does a bone need to know about it's children?

Share this post


Link to post
Share on other sites
Advertisement
If you move your real life upper arm bone, you will automatically transform
your lower arm bone and your hand-bones aswell.

If you do this in your game, how would you know what childrens to transform
based on the one transform of the upper arm bone if you dont have information
stored in a parent-child hierarchy?

Share this post


Link to post
Share on other sites
Quote:
Original post by r1nux
If you move your real life upper arm bone, you will automatically transform
your lower arm bone and your hand-bones aswell.

If you do this in your game, how would you know what childrens to transform
based on the one transform of the upper arm bone if you dont have information
stored in a parent-child hierarchy?


Oh, so it prevents doing wasteful, unneccessary transformations? Because technically you could transform every bone for every animation just using it's parents data but it would be inefficient, right?

Share this post


Link to post
Share on other sites
Quote:
So basically, why does a bone need to know about it's children?


Actually it doesn't. I personally just create a plain list of bones and store the index to the parent bone (-1 for root bone):

struct Bone {
int index;
Matrix relative;
Matrix absolute;
};

class Skeleton {
public:
std::vector<Bone> bones;
};



animations calculate and store the final matrix in relative and then the absolute is calculated by multiplying parent absolute to relative.

Kasya

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!