T0X1N Posted October 22, 2010 Share Posted October 22, 2010 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. Quote Website | Twitter | Facebook | Steam Play Our Latest Game: Relic Rogue Link to comment Share on other sites More sharing options...
Josh Posted October 22, 2010 Share Posted October 22, 2010 SetEntityScale(). If you are using LoadScene, it should just be the same as the editor. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
T0X1N Posted October 22, 2010 Author Share Posted October 22, 2010 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. Quote Website | Twitter | Facebook | Steam Play Our Latest Game: Relic Rogue Link to comment Share on other sites More sharing options...
Recommended Posts
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.