So, I found a great example (and posted my question in that thread), unfortunately, I don’t think anyone scours the code example sub forum for giving help. So, I’ll ask here.
[Simple Picker Class)
That’s the thread that is giving some example code. I was playing around with it, but am having trouble specifying a new node for the new top level node. I’m pretty sure it’s a syntax thing, but I thought others may have the question down the road, so I would post it here as well.
I guess if the way that script is working, it always transverses back to the top node (even if a different node is provided–or I’m doing it wrong, which is more likely) I could always create a new node to be parallel to the render node on the scene graph (I assume this is possible?)
Anyway, help is appreciated as I delve more into the crazy world of Panda
After doing some reading, I think I might be able to ask a better question now… I hope.
So, obviously nodes are objects, right? And when you create a new node, whether it be a collision node, a light node, or basically anything under the render node, you can’t just call it by name, you have to pass in the object handle; yes?
So, if I have two files for my game, they’re includes and one is responsible for setting up the collision geometry, how can I pass the collision geometry node handle into some function? I obviously can’t do it by name. And since these functions are very far apart and don’t really talk to each other, I would like to do it in a very self contained way. Basically, get the node handle (I’m not sure if I’m using ‘handle’ right in this case, please correct my vocabulary if it’s wrong) by traversing the scene graph and then do something with it.
All the examples I’ve seen are self contained in one file so local references are okay. But for my purposes that would be a pretty big re-write at this point. I’m about 20 files in and 10,000 lines long and I would prefer to not have to do any major restructuring of my code at this point if possible
I’m wondering if what I’m trying to do is just get a single node reference; e.g. when I do:
self.FCG = render.find("**/worldCollision")
self.FCG = self.FCG.getParent()
self.mouseClick = Picker(self.FCG)
In the console. I’m trying to pass in a single node reference, in this case, worldCollisionGeom, as everything under that should be “clickable” with the script in my first comment. When I try to pass in a node other then ‘render’ it just doesn’t work at all.
Edit: I’d like to clean up the mouseclick script that I linked to. But I’m hoping to get help with what it’s doing wrong because I’m not seeing why this behavior is happening.