Terrain Editor to heighmap

Is it possible to create a terrain in Terrain editor and get it to a height map or get a greyscale map of it and create a height map out of it?

Or is it possible to get the nodes added to in terrain Editor somehow in game, to check distance player to object or something else like rotate stuff in simpleupdate loop?

Kind regards
Alex

1 Like

Well done Norman, I allready watched this movie but i missed the part how to get the scene node if it is made in SceneComposer.
Its now clear to me how to handel it.

Thank you very mutch for this hint, i was trying to get this working for days now.

To other people:
What I tried to do was first generating a terrain, than placing trees, or other objects in the scene or place them automaticaly by code.
For this I need the Y coordinates of the pre made terrain from SceneComposer.
Now I wanted to scale them randomly between 1.0f and 2.0f and also turn them randomly so I can use 1 Tree Model and they look diffrent (scale, rotation).
For this i need the preplaced trees from the terrain made with SC.

But I could not get the Scene, I didnt even know if it was possible to get it. Infact it is.

What my mistake was, I loaded the scene and attached it to rootnode but I tried to catch the scene before I attached it to the rootnode.
Offcourse I always got nullpoints and thought it could be cause of the scene.

Example:

1st. Create a new scene file
2. open the file with SceneComposer
3. Rename your SceneNode to a name you like and you can remember :wink:
4. Use Terrain-Editor and make your terrain.
5. Use SceneComposer and place Models (Trees, Cars, Buildings, Stones what ever you like)
6. Check that your Scene is well structured with Nodes and child Nodes so you can find them easy ([Scene]-> [Terrain, Trees] -> [Terrainquad1,Terrainquad2, …] or [Scene] ->[Terrain, Trees] -> [Tree1,Tree2,Tree3…]
7. Save your Scene

  1. Load in your main.java file this scene.
  2. Find the first Node with the name given in the SceneComposer
  3. Find the next Node with the name given in the SceneComposer and so on.
  4. Now you got full acces to the node you can handel it as same as you made it with code.

This makes it a lot easier and a lot more visible what your code is doing. You dont need to init light manual or create a heightmap anymore or add controls or physics by code.
Just use the SceneComposer and place what you need. Load your scene and edit the stuff if it is needed.

[java]
Node gameLevel = assetManager.loadModel(“Scenes/euphoria.j3o”); //This is the file name of my predefined scene
bulletAppState.getPhysicsSpace().addAll(gameLevel); //Load the physics of the whole scene
rootNode.attachChild(gameLevel); //Attach the whole scene to rootnode, now you can catch everything you made in Terrain-Editor

//Example
Node scene = (Node)app.getRootNode().getChild(“Scene”); //This is the Name of my 1st level Node
System.out.println("RootNode Children: "+app.getRootNode().getChildren()); //Print all the Nodes attached to the 1st level Node
System.out.println("Scene Children: "+scene.getChildren()); //Get all children attached to the Node scene, and compare with rootNode they should be the same
Node trees = (Node) scene.getChild(“Trees”); //Get the 2nd level Node
System.out.println("Scene Tree: "+scene.getChild(“Trees”)); //Get all children attached to the 2nd level Node
Node tree1 = (Node) trees.getChild(“tree1”); //Get one 3rd level Node,
tree1.setLocalScale(1.0f, 2.0f, 1.0f); //Resize the 3rd level Nodes scale to 2.0, to see that it really works :wink:
[/java]

Edit:
@Norman

If I add 20 trees i can change them individual by calling each of those nodes. Does this work with 20 linked trees too or do i scale all of them at the same time?

Edit2:
I did try the linking of trees, it seems it works exactly the same as adding does. Infact with linking it is still possible to change the model that means all objects from the terrain are getting changed by changing the one model.

  1. I would appreciate if anyone could add this case to the tutorials because I searched for days to get this working. And there are probably other people wana use this.
  2. Norman said: Dont use NB just use the SDK 3.0. In this case it would be nice if the examples explaining how to activate NB to make use of Android will be deleted from the tutorials.
    It is not only a waste of time, it may break the SDK. Infact I ran into problems whith NB switched on.

Picture of the TreeStructur to the code above: