Skeletal Animation Question

Started by
2 comments, last by Kasya 13 years, 11 months ago
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?
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?
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?

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

This topic is closed to new replies.

Advertisement