Problem with animating pieces

So, I have a simple model and animation that I have put through optchar, and flagged the sphere as a separate object so I can manipulate it a la the “Manipulating a Piece of a Model” manual page. After assigning it in the program, I can move it, hide it, etc, but I cannot animate it separately. This is really the only thing I wanted it for, so I was wondering if it’s not for animation purposes or if I’m just doing something wrong in the code. For reference:

import direct.directbase.DirectStart
from import Actor

myChar = Actor()
myCharBall = myChar.find("**/Ball")
print myCharBall


If I try to use myCharBall.loop(), it crashes and I get an error that the node has no attribute “loop”. I also can’t separately load its animations using loadAnims. Do I have to use multi-part actors for this (which I am willing to do, but would rather not), or am I just missing something here?

In your case, it sounds like you’re looking for sub-part animations, a simpler system than the multi-part animations described in the manual. Search the forums for “makeSubpart”.

You can also use controlJoint() to allow you to use the scene-graph manipulations on a node. This is different than loading a separate animation on a part of your model, but in a simple case like this it can achieve a similar effect. One of the demo programs that ships with Panda illustrates this.


I got the makeSubpart animations working, thank you! I have been trying to get different ways of doing this working for days with no luck. This solution makes a lot more sense.