public Spatial clone(boolean cloneMaterial) {
        // Set up the cloner for the type of cloning we want to do.
        Cloner cloner = new Cloner();

        // First, we definitely do not want to clone our own parent
        cloner.setClonedValue(parent, null);

        // If we aren't cloning materials then we will make sure those
        // aren't cloned also
        if (!cloneMaterial) {
            cloner.setCloneFunction(Material.class, new IdentityCloneFunction<Material>());
        }

        // By default, the meshes are not cloned.  The geometry
        // may choose to selectively force them to be cloned, but
        // normally they will be shared.
        cloner.setCloneFunction(Mesh.class, new IdentityCloneFunction<Mesh>());

        // Clone it!
        Spatial clone = cloner.clone(this);

        // Because we've nulled the parent out we need to make sure
        // the transforms and stuff get refreshed.
        clone.setTransformRefresh();
        clone.setLightListRefresh();
        clone.setMatParamOverrideRefresh();

        return clone;
    }
@return A clone of this Spatial, the scene graph in its entirety
is cloned and can be altered independently of the original scene graph.

Note that meshes of geometries are not cloned explicitly, they
are shared if static, or specially cloned if animated.

@param cloneMaterial true to clone materials, false to share them
@see Mesh#cloneForAnim()
jme3-core/src/main/java/com/jme3/scene/Spatial.java