4
votes

I am trying to load and render some rigged models using Assimp 3.1.1 So I have the aiBone's identified in the hierarchy of aiNode's. For each aiBone, I have its transformation (TRS) w.r.t. to the parent.

My question is, how can I determine the length of each bone? Assuming a connected skeleton, this is not a problem for most of the bones, except for the leaf bones. Assuming I have the following skeleton structure: b0 --> b1 --> b2 with b0 being the root bone and b2 being the leaf bone. How can I know the length of b2 (since I only have its transformation w.r.t. b1)?

Thanks!

2
I'm having a similar difficulty, don't suppose you resolved this?Tim Kane

2 Answers

1
votes

So, after a little further digging.. ISTM that there isn't any implicit way of knowing where leaf bones should terminate.

The following code comments are referenced from the Ogre3D wiki (it's not assimp, but we're talking about the same problem here).

if(numChildren == 0)
{
    // There are no children, but we should still represent the bone
    // Creates a bone of length 1 for leaf bones (bones without children)
    // ...
}

I suppose you could consider trying to calculate the length of a leaf bone, by calculating the distance from the bone to the edge of the mesh that you're rendering.. though that might be more trouble than its worth.

1
votes

Even though most SDKs and game engines define a skeleton as having bones, that's incorrect. It actually has joints. The bones are the implied connections between joints. When you look at it this way, you realize that all bones have a length and there is no bone extending past leaf joints.

Replacing your example with joints:

J0 ---B0---> J1 ---B1---> J2

B0 is the bone between J0 and J1, and B1 is the bone between J1 and J2.