Is geometry in the scene or not?

Guys I want to know if a geometry is in the scene or not? How can I do that?

Check if the rootNode is one of its parents/ancestors.

Is there an easy way to do that? I add the spatial of that geometry in a node attached to the rootnode. I checked like that if (object.getParent() == customnode). However I think because the node structure is linked like objectGeometry -> objectSpatial -> customNode -> rootnode, I cannot reach customNode.

Maybe get the parent with a recursive method until you “reach” the object you wanted?
Get all the parents and check if rootNode is one of them.

Spatial provides a hasAncestor method. Just call that.

i.e. spatial.hasAncestor(app.getRootNode())

1 Like