morad Posted February 17, 2012 Share Posted February 17, 2012 Hi I'm just started scripting with lua with the demo version, using the great tutorials on youtube. I'm have a problem with the terrain elevation\height: when i load the terrain height map its doesn't fit to the visible scene texture. Any ideas? Thanks Morad Quote Link to comment Share on other sites More sharing options...
morad Posted February 17, 2012 Author Share Posted February 17, 2012 --loading the terrain and scene terrain=CreateTerrain(2048) LoadTerrainHeightmap(terrain,"abstract::deserthighway_height.RAW") world=LoadScene("abstract::deserthighway.sbx") world:SetCollisionType(2) (i have a body attached to the camera) -- calculating the height of the camera above the ground ALT=math.floor((body.position.y-TerrainElevation(terrain,body.position.x,body.position.z))/0.3048) Quote Link to comment Share on other sites More sharing options...
macklebee Posted February 17, 2012 Share Posted February 17, 2012 why are you creating a terrain and also loading a terrain from the SBX file? just load the SBX and it will load the terrain for you... also, you do not have to set the collisiontype for the loaded scene... it will be done automatically for the terrain Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Josh Posted February 17, 2012 Share Posted February 17, 2012 If your body is parented to the camera, you will need to transform its position from local space to world space to get the correct position for the call to TerrainElevation(). See TFormPoint(). 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...
morad Posted February 18, 2012 Author Share Posted February 18, 2012 When i don't create the terrain i don't know the terrain Entity name so i can't use it. When i use "terrain" i get an "Exception access violation" message. Do i need to create a world first or anything else is wrong? I tried to transform to global coordinates. the different i got was twice the distance to each axis. Still didn't get the right height. ??? Quote Link to comment Share on other sites More sharing options...
Josh Posted February 18, 2012 Share Posted February 18, 2012 A world does have to be created before any entities, but I would like to see your entire script so I can run it myself. 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...
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.