[SOLVED]Relating 3d object with a python object

Hi guys, I am having some troubles with 3d object selection.
I am coding a small arena game where multiple player can fight each other, you walk with ASDW and use abilities on a player that is your current target, to set a player as your target, you must click on him.
I have managed to successfully detect when I click on a model (with a collision ray colliding against the model geom), but I couldn’t find a way to relate the collision entry information with the Player class object.

The collision entry information is:
from render/camera/mouseRay
into render/Ralph/__Actor_modelRoot/-GeomNode []
at 0.160758 39.5216 1.88195
normal 0.357934 -0.710481 0.0842593
respect_prev_transform = 0

Is there any easy way to do so?


You could use tags to attach the “player” object to the model (a GeomNode in your case, but setting tags is possible with any PandaNode).


…with np being a NodePath for the GeomNode, and player being the instance of the player class.

Thanks for the reply, got it working now.
I am using a dict to map the NodePath to the instanced object…