Sign in to follow this  

Skeletal Animation Question

This topic is 2790 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
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

This topic is 2790 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this