:?: Controlling the model

Hello! I’m not sure if it’s even possible, but I want to control the model of the human directly, for example using some keys to raise hand etc. I mean each hand/leg, head. I have a model with armature imported to my app through

NodePath avatar = window->load_model(framework.get_models(), "res/male");

How can I get the exact part of my model?

I’m new to 3d programming so maybe it’s a wrong way. Any help needed.


The manual states precisely how to use actors, how to get particulat parts of models etc.

See panda3d.org/manual/index.ph … and_Actors and following.

I’ve already read this manual few times, but I still don’t see the information I need. There is info about static models and Actors ( actually, as far as I know, thre is no such class in C++ reference ). so, is it possible to use One .egg file of whole body, but control the parts of it using armature or somehow else?

Excuse me if I don’t understand something.

Thank you for reply!

Yes, it is certainly possible. The “looking and gripping” sample program demonstrates this in Python.

In C++, it is more difficult, because you don’t have access to the high-level Actor class. Instead, you have to work with the same lower-level structures that the Actor class works with.

Before you do anything else, you have to have an animation loaded and playing on your character. Otherwise none of this will do anything. It can be a one-frame animation if you don’t actually want it to move, but it must have something. I assume you already know how to do this from the examples in windowFramework.cxx:

auto_bind(root.node(), anim_controls, ~0);

Once your animation is playing, to control a joint you need to find a handle to the Character node, with a line something like this:

And then from there you can get the PartBundle, which is the root of the joint hierarchy:

PT(PartBundle) pbundle = char->get_bundle(0);

And from the PartBundle you can call control_joint() to assign a particular PandaNode’s transform to the joint you like, by name:

NodePath control("control");
pbundle->control_joint("elbow#1", control.node());
control.set_hpr(0, 20, 0);

Feel free to study the Actor.py code for more specific details.


1 Like

Thank you very much! That’s what i was looking for =) And yes, I’ll study Actor class. Thank you once more!