My game currently has vehicles that are parts of their own classes (e.g. a tank would be of class Tank, etc.)
I also have mouse picking implemented, and the user can click on a tank.
However, this returns the NodePath of the tank.
I’ve considered using tags to mark what class instance it belongs to, with no success.
Can someone suggest alternatives / workarounds?
Thanks,
XboxJosh.
you can use self.tankNodePath.setPythonTag(“TankClass”,self)
PythonTags work very similar to the “normal” tags. but instead of strings you can throw in pretty much everything provided by python.
rdb
October 31, 2009, 4:00pm
3
Keep in mind that “self” will then never get garbage collected until you clear the python tag (as you create a cycle reference)
Cool, thanks, I didn’t know that was what setPythonTag was for (I thought it was the same thing )