Return children nodes(objects)

Hi,

I’m new to panda3d and python. I’ve been coding for about a week and have gotten pretty far but I have a question I can’t seem to find in the API.

The program I am writing creates various objects(bots) with attached child objects(arms). The number of arms is different for each bot. Now, is there are way to create a for loop to cycle through all of the children(arms) of each bot? I want something like:


for child in bot:
    pos =  child.getPos()

I’ve tried the “nodePath.ls()” command but it isn’t recognized.

Thanks, any help would be great.

have a look ar http://panda3d.org/manual/index.php/Searching_the_Scene_Graph
at the bottom of the page is explained how to get a list of children.
after you got the list just do
for child in listwitthchildren:
pos = child.getPos()

should work… not tested,thought^^
good luck with it =)

and dont miss the panda3d irc channel. people there should be able to help you with such problems quite fast =)

greetings
thomas e

And here is the page in the manual:
http://panda3d.org/apiref.php?page=NodePath#getChildren

Thanks,

That fixed it.