I suppose setting the relevant nodepath’s name as a tag on the collisionNodepath and then retrieving that name from the collisionNodepath when it collides with something would work, if this is a permanent change in future versions…
I’m not aware of a change in Panda that relates to this. From what format are you loading your models?
You could walk up the scene graph until you find a node with a certain name, or of type ModelRoot, or of type Character, depending on which node you want to manipulate.
Testing this using the Roaming Ralph sample with a Panda version from last year, I see that e.g. the exposed LeftShoulder joint is parented to PandaNode “Ralph”:
PandaNode Ralph
Character __Actor_modelRoot
GeomNode (2 geoms: S:(ColorAttrib TextureAttrib))
PandaNode LeftShoulder T:m(pos 0.566846 0 3.13553 hpr -82.426 -37.1751 -161.032) E:(CharacterJointEffect)
while it is parented to the Character node with a recent Panda version:
PandaNode Ralph
Character __Actor_modelRoot
GeomNode (2 geoms: S:(ColorAttrib TextureAttrib))
PandaNode LeftShoulder T:m(pos 0.566846 0 3.13553 hpr -82.426 -37.1751 -161.032) E:(CharacterJointEffect)
This explains the results that @Game_Starter is getting.
Perhaps the solution in this particular case is simply to get the name of the Character’s parent, in other words adding another get_parent() call?
@rdb I’m loading them from the .egg format. The setTag, getTag method works for me given this change. @Epihaius to test whether adding another getParent() works I’d have to reinstall the newer version, though if you’ve tested to see if it does, you can tell me!
Well, either way, the setTag, getTag works reliably for me in both versions; I was mainly curious as to whether this change would be permanent, if it is, so be it!
Ah, thanks for the detective work, @Epihaius. Indeed. that looks like it may be responsible for this change. I do think the new behaviour is the better behaviour (unless someone gives good reasons to the contrary). I will ensure that it is documented in the migration notes.
A somewhat cleaner version than setTag that remains cross-version compatible might be something like this:
actorNP = collisionNP.getParent()
if isinstance(actorNP.node(), Character):
actorNP = actorNP.getParent()
Instead of all these getParent calls though, it may also be possible to simply call getTop() on your collision NodePath, but then you obviously have to make certain you do this before parenting the Actor to render or any other node. Just an idea!
Oh and please don’t let changes like these deter you from using the newest Panda versions, @Game_Starter! If you keep an eye on the issue pages at GitHub, you probably won’t run into too many surprises. And you can then give your opinion there if certain changes are being proposed that affect your project.
(Since I got my Helpdesk badge on this forum recently, I guess I have to say stuff like this now .)