Terrain Editor - Loading from Scene LOD Control

Hello guys, i need a ligth!



i’m triying to load a Terrain that i made using the Terrain Editor Plugin, it loads fine, in the tutorial at the end is the paragraph about using de LOD control i it says use this:



TerrainLodControl lodControl = ((Node)terrain).getControl(TerrainLodControl.class);

if (lodControl != null)

lodControl.setCamera(getCamera());





But is not working the lodControl still being null



i’m loading in this way



Spatil terrain = assetManager.loadModel(“Scenes/Terrain.j3o”);



thanks if anyone can help

Look in the SceneExplorer on which node the control actually is and get that with loadedTerrainModel.getChild(“terrain-blah”). Then grab the Control from it :slight_smile:

If there isn’t one on the root terrain node (maybe it isn’t being added by default by the editor any more…) you can just add one manually.

If the editor isn’t creating one, I will have to fix that.

Spatial terrain = assetManager.loadModel(“Scenes/Terrain.j3o”); <---- i miss the “a” in this post but in my code its fine. i was wondering if the LOD it is already there? an i dont have to do nothing is this posible? thanks for any help

Wow guys! thanks you are so fast! i will try to grab it …

I looked at the add terrain code in the SDK and it does add the LOD control, it is attached to the root terrain quad object.

It’s just how you are loading the terrain. The name of the terrain will be (“terrain-”+sceneName), so if your scene is called “level1” then the terrain name will be “terrain-level1”. Use that and the code normen posted to find the object, and get the terrain from that.

When you load a scene you created in the SDK, there will always be a root node with all of the other spatials under it.

Thanks it works!



TerrainLodControl lodControl = terrain.getChild(“terrain-Scene”).getControl(TerrainLodControl.class);

if(lodControl != null)

lodControl.setCamera(getCamera());