Actor vs Character

Hi all,

Just trying to serialise my scene and noticed something a bit weird. When I turn a node path into an actor it seems to create an odd hierarchy. For instance, turning the panda from the hello world sample into an actor gives you:

PandaNode "panda_walk_character"
    Character "__Actor_modelRoot"
        GeomNode ""

So it seems on inspection there’s no way of looking at the panda node and figuring out if it’s an actor without looking at the node immediately under it. Fair enough - just wondering what happened to my ModelRoot node though? I grab the file path of the model from that for static node paths but how would I get the model path from an actor?

The Actor class creates its own hierarchy to suit its needs; it uses the ModelRoot you give it to do so, but the hierarchy it creates is no longer the same as the original ModelRoot. So there’s no way to recover the ModelRoot you used from the Actor you created from it.

Also, keep in mind that Actor is a Python-only class; the Actor itself is not actually stored in the scene graph, just the nodes that implement the Actor. So if you find a node from the scene graph using something like find(), or using the collision system or something, the node you find is part of the Actor, but not the Actor itself. If you want to find the original Actor, you will have to use something like setPythonTag() to store the Actor pointer on the node.


Thanks for your reply, David.

I’ve pretty much gone down the path you’ve suggested and am holding on to the actor node once it’s been created. I’m also recording the file path the original model came from as that seems to vanish along with the ModelRoot.