Sign in to follow this  
X Abstract X

Skeletal Animation Question

Recommended Posts

X Abstract X    109
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
r1nux    139
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
X Abstract X    109
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
Kasya    207
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

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