7
\$\begingroup\$

I'm trying to implement a renderer using a scene graph and skeletal animation. As far as I know the bones in a skeletal animation just represent a connection between two joints. However, if a Joint knows its parent- and child-Joints what would you even need bones for?

Also, why would you need a separate class, Skeleton to represent a 2D entity (whatsoever) when the Skeleton is just an array of joints? Isn't that just a waste of memory? Am I missing something?

\$\endgroup\$
  • 3
    \$\begingroup\$ Why would you need edges in a graph structure when nodes know their connections to other nodes? \$\endgroup\$ – user253751 Aug 11 '16 at 21:21
9
\$\begingroup\$

Without knowing the details of your particular implementation it is hard to say, but in general a "bone" is just another term for either a "joint" (a 3D position that will be animated) or a "joint plus reference to the parent joint."

This

However, if a Joint knows its parent- and child-Joints what would you even need bones for?

implies to me that you're using the latter definition in your system (have joints which know their parent) and thus "bone" is just another term for what you already have.

Also, why would you need a separate class, Skeleton to represent a 2D entity (whatsoever) when the Skeleton is just an array of joints?

It sounds like you're asking why you'd want to have

struct Skeleton {
  Array<Joint> bones;
};

instead of

Array<Joint> skeleton;

If that's the case, it's generally for the same reason you'd want to have a structure for a 3D vector instead of passing three floats everywhere. It encapsulates the logical concept you're trying to express, improving readability to some degree and providing you a place to hook various related functionality (such as, perhaps, updating all the joints in the skeleton with new positions based on some input animation data).

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.