Changes in getting a nodepath from an exposed joint, in new 1.10.0 version?

So in a prior version 1.10.0, this one:

Panda3D-SDK-1.10.0pre-9bfc425.exe

Whenever I:

  • Exposed an actor joint
  • Attached a collision geometry, such as a collision sphere to the exposed actor joint
  • Added the collision geometry to the traverser
  • Then, in game logic, sought to get the nodepath associated with the collision geometry, here is the path that worked:
  • CollisionSphere->Exposed actor joint->Nodepath collisionNodepath.getParent().getparent()

That worked wonderfully. However, upon updating to this version 1.10.0:

Panda3D-SDK-1.10.0pre-71e18eb.exe 

This is the path that is returned upon calling collisionNodepath.getParent().getparent()
CollisionSphere->Exposed actor joint->__Actor_modelRoot

Is this a permanent change? If so, how would I go about getting the nodepath associated with the collision solid attached to the actor’s joint?

P.S. This is how I load an actor onto the scene:

           self.current_avatar=Actor()
           file_name=Filename.fromOsSpecific(path_to_model)
           self.current_avatar.loadModel(file_name)
           self.current_avatar.reparentTo(render)

Thanks in advance.

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…

...
collisionNodepath.setTag("relevantNodePathName","actualNameOfActorNodePath")
...
jointFromCollisionNodepath=entry.getFromNodePath()
actorNodePathName=jointFromCollisionNodepath.getTag("relevantNodePathName")
actorNodePath=render.find(actorNodePathName)

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.

It appears to be the result of fixing issue #221.

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! :grin:
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!

I appreciate the replies.

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()

Glad I could help, guys! :slight_smile:

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 :sweat_smile:.)