Getting object from collision event

I am wondering what the best way is to get a reference to an object from a collision. For instance I have several objects in my game, and their models are part of the object, i.e. tree.model or something. It seems as though entry.getFromNodePath() gives you the model nodepath, how can I get to my object? At the moment I am using entry.getFromNodePath().getName() and using string processing, which seems like a bad idea.

Using nodePath.getName() is a fine idea. Another approach is to use nodePath.setPythonTag() to store a pointer to your object, as described midway down this page. There are pros and cons with both approaches.


Thanks, thats very interesting, I had missed that page somehow.