Hi,
I am attempting to generate LOD for the trees in my game. I have generated the levels of detail in the scenecomposer, and I can set the level of detail manually in-game by using spat.setLodLevel(SOME_LOD_LEVEL);
Obviously though I don’t want to keep manually setting the LOD, so I’m trying to attach a LodControl. It doesn’t seem to work though:
LodControl lc = new LodControl(); lc.setTrisPerPixel(1f); spat.addControl(lc);
This doesn’t seem to work though, as I can only attach a LODControl to Geometry, not Spatial.
So, I tried attaching it to the geometry:
Node n = new Node(); n.attachChild(spat); for (Spatial sp : n.getChildren()){ if (!(sp instanceof Geometry)) continue; Geometry geom = (Geometry) sp; LodControl lc = new LodControl(); lc.setTrisPerPixel(1f); geom.addControl(lc); }
However this seems to do absolutely nothing.
So, how can I attach a LODControl to the spatial?