Jump to content

Loading Terrain from Scene


T0X1N
 Share

Recommended Posts

Hi, I am having some trouble figuring out how to load terrain from a .SBX scene. In the editor, I am using 2048 resolution, 1 meter per tile, and 100 as the altitude. I am also using the Framewerk library in my program.

 

My problem is with the altitude. When I load the terrain's height map into my program, it looks like it uses 1000 as the default altitude. My question is how do I lower the altitude to 100? Here is my current code that creates and loads a height map:

 

terrain = CreateTerrain( atoi(GetEntityKey(entity,"resolution", "2048")));

LoadTerrainHeightmap(terrain,"test_height.raw");

EntityType(terrain,1);

 

I have tried looking through the wiki, but it really does not explain what SetTerrainHeight() does and how to use it and I have tried looking through the forums and found nothing explaining how to load terrain directly from a scene.

 

Also, getting the "resolution" does not seem to work with GetEntityKey as it just uses the default value.

 

Thanks, in advance.

Play Our Latest Game: Relic Rogue

Link to comment
Share on other sites

I forgot to mention that I am using LE 2.31 with Framework. SetEntityScale() is not an available command, but if I use ScaleEntity(terrain, Vec3(scaleval#)) my terrain is completely flattened.

 

I am using LoadScene, this code is within the ProcessScene() code for terrain loading. I am using "test.sbx" as my scene that I am loading so the heightmap is called "test_height.raw".

 

Thanks for the response though.

 

EDIT:

 

Gah, I am such an idiot. LoadScene() does load the terrain including all the textures, heightmap data, and the alphamap data. I have been freeing the terrain the whole time with the command FreeEntity(scene) inside the ProcessScene() function and trying to replicate a task that has already been done for me. Freeing the scene from memory deletes the terrain because the terrain is parented with the scene entity. I was over complicating such a simple task. :)

Play Our Latest Game: Relic Rogue

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...