Hey guys, I have a rootNode that has three parentNodes where each of these parent nodes contain children.
if I want to get a spatial from these parentNodes and I dk which is the parent how can I do so?
I tried:
[java]
rootNode.getChild(id); // where id is the unique id of spatial
[/java]
but it wont find it unless I do rootNode.getParentA.getChild(id);
anyway to loook through the rooNode without knowing the parent node?
You mean that id is the name? You are using this method?
http://hub.jmonkeyengine.org/javadoc/com/jme3/scene/Node.html#getChild(java.lang.String)
It will automatically search for children. Just call it on the root node.
1 Like
id is the String unique id of the spatial (or name). Yes, thta is the method, and it won’t find a spatial that resides in a another node under the rootNode. It only finds children inside the rooNode but not another level deeper (within a sub node)
You are incorrect. It will search sub-nodes too. I looked at the code before responding the first time.
YOU ARE right!! Sorry I wasn’t passing the right id!!
thx!!!