Spatial to Node

I want to get the childs of a Node, but theres only a method that gives me a spatial arraylist, and spatials dont seem to have a getchildren method.

I tried to cast the spatials from the list to node, but I get this exception:

Exception in thread “AWT-EventQueue-0” java.lang.ClassCastException: com.jme3.scene.Geometry cannot be cast to com.jme3.scene.Node

when I use this loop:

for(Spatial spatial:child.getChildren())




what should I do to get the spatials children?

If you only want nodes then do


if(spatial instanceof Node) {




Also, SceneGraphVisitor might be useful for you too