I have a model called level_0_0.j3o that I want to load when grid (0,0) is loaded. I the code below does thing fine except that when I move around in the terrain, the model level_0_0.j3o disappears and appears even though the grid (0,0) is still on screen.
I presume the terrain is not attached to the sceneNode, which is what you use for collision checking? I guess we are switching one problem for another here. It might be easier to find out why the terraingrid is firing the detached event when it isnt detaching…
If you don’t use nightlies, you can remove line “lodControl.setExecutor(threadpool);” of World.java.
Its a multi-threaded terrain loader with load/unload events and a cache, amongst other things. The code is robust and has been tested quite extensively. Feel free to use, abuse and butcher as you see fit.
@Pixelapp said:
@jayfella Wow, your terrain system works right out of the box. Thanks. I'm already using it on my game.
I think this should replace terrain grid. What do you think @normen ? I don’t want other JMonkeys to be left out, without a terrain system :).
The terrain system is not going away. Just the randomly generation part that someone started and didn’t complete.
In my opinion, these things work better as a plugin like what jayfella has done. He can iterate and fix things without having to wait for a new version of JME to get (finally) released. It also avoids the issue of having these partially implemented things hanging around in the core download.
@jayfella Are there any special considerations to be taken when using the ImageBasedWorld “createWorldWithImages();”? It doesn’t load the .jpg.
But when I use the NoiseBasedWorld it works just fine, but that’s not what I want right now.
@jayfella You provided the .jpg(s). When they are not found it clearly tells you on the console, but for the 4 jpgs you provided it doesn’t complain and they don’t show up either. Which is the problem.
Edit: I use my own image and still doesn’t show up.
ooooh. I took a look myself. Its the height multiplication. It needs to be multiplied. The values of each pixel in the image are returned between 0 and 1, so they need to be multiplied by the world height: