Hello there.
I wonder is there is abetter solution for what I am doing.
If I have a CollisionTraverser and CollisionRay, so I declare a “MouseOver” Task to get the CollisionHandlerQueue node being collided reading getEntry(0).getIntoNodePath(). This works with mouseover/mouseout events, no issue at all.
So, because I need a different function/method with parameters to be called for each NodePath and for each event, I made something like
When “Mouse Over” happens in that “NodePath”, execute “Function()” with this “var_values”
I have solved this in the following ways, none seem to be the proper one:
-
Writing an entry into a dictionary when node is created like {"/this/nodepath": Function()} using globals() to store the function itself and another entry to store/pass the parameters if any. This one is the current solution I am using.
-
Using PythonTags, and store the NodePath and the parameters, making the same globals()[“Function”] call. The thing is it slower the performance in a very noticeable way: about 0.1ms to read the tag variable content and it lags.
I tried also to store (via dict or PythonTags) a class with the Function() method instead of globals() calls, but something says me there would be a better way.
Am I missing something?