Get object at certain location


I can't find right now a way to find if there's an object (and which one) at given x, y, z coordinates.

Any help?

If you really want to check for an exact Vector3f(x,y,z) you could do something link that:

        // get all spatials from rootNode
        List<Spatial> allSpatials =  rootNode.descendantMatches(Spatial.class);
        for (Spatial sp : allSpatials)
           if (sp.getWorldTranslation().equals(your_vector))
                    do whatever you want


But that is really only the case if the center of the object is at that location. Otherwise you will have to create a boundingvolume and then have to check this boundingvolume (e.g. boundingsphere) with


instead of the equals part in the if-condition