How to get Joint names from an Actor

Is there a way of getting a list of all available joint names from an Actor? I thought Actor.getJoints would do something like this, but it only seems to return an empty list.
Sadly the API reference doesn’t help much, because all of the Actor methods are undocumented.
If anyone knows a way to get more info from the structure of n already loaded actor, please let me know.

Looking at the source, getJoints seems to be expecting a joint name as parameter. Which is correct, because if I supply a correct joint name, it returns a list just containing that joint. I haven’t found a way to supply a * or so which returns all items. There should be a way… it would be odd to have a listJoints but not a way to get them in a list.

Looks like getJoints() is designed to return a list of all joints with the given name across all the parts and all the LOD’s. Not particularly useful in a single-part actor, but might be handy with a multi-part or multi-LOD actor.

I think the Actor code is written on the assumption that you already know the joints that are in your Actor (normally, there’s not much point in accessing an arbitrary joint without knowing exactly what this joint does). Of course, there are always exceptions.

You can get the list of joints by recursively walking through the hierarchy. Get a pointer to the partBundle with actor.getPartBundle(), and then iterate through part.getNumChildren() / part.getChild(). Each child so returned is a joint (you can call joint.getName() to get the name of the joint). You can also call joint.getNumChildren() / joint.getChild() to continue the recursion.

This is the same thing that Actor.listJoints() does, if you examine that code.

David

thanks for the explanation David. I just found out that I needed to use listJoints instead of getJoints, But it’s good to have some more info on how it actually get the information.