Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / DGSDK dbGetTerrainGroundHeight not working

Author
Message
Denaje
19
Years of Service
User Offline
Joined: 5th Feb 2005
Location:
Posted: 28th Mar 2006 04:35
I searched the DarkBasic forums but I did not find any related threads, so here goes:

I created a terrain in my program, as you can see in my code (sorry, kinda messy). The terrain is displayed just fine, the right size and orientation and all, but when I use the dbGetTerrainGroundHeight(...) command, it only returns the Y value that I positioned the terrain at (in this case, -52*4=-208). It does not return what the height of the terrain is according to the height map at any X and Z position. Is this command broken or am I doing something wrong?
Profit
18
Years of Service
User Offline
Joined: 19th Feb 2006
Location: United States
Posted: 28th Mar 2006 21:14 Edited at: 28th Mar 2006 21:16
just put the code with the code tags. that button doesnt work.
dealing with terrain, i haven't had any luck with it either.

common people are walking in line.
Denaje
19
Years of Service
User Offline
Joined: 5th Feb 2005
Location:
Posted: 28th Mar 2006 21:56
mmk here is the code:

Denaje
19
Years of Service
User Offline
Joined: 5th Feb 2005
Location:
Posted: 31st Mar 2006 00:39
Well, uh, I tried saving the terrain using dbSaveTerrain(...) and then next time I loaded it, and it crashed no matter what I did. So that did nothing, and dbGetTerrainGroundHeight(...) still doesn't work. Does anyone have any ideas? Could there be some other way of figuring out what the height of the terrain is at a certain point?
Artus
19
Years of Service
User Offline
Joined: 25th Feb 2005
Location: France
Posted: 2nd Apr 2006 23:40 Edited at: 2nd Apr 2006 23:42
I think dbGetTerrainGroundHeight(...) takes coordinates relative to its own position (I am not 100% sure because I have not used the DGSDK since a few months - in fact since it was announced that a new update was coming soon and I decided to wait for it before going further - and I start forgetting). Did you change the XZ position of the terrain ? If yes, substract these positions to that you pass as arguments to the function.
If you always get the Y position of the terrain object instead of an altitude, I think that it is because you are checking out of the terrain.
Denaje
19
Years of Service
User Offline
Joined: 5th Feb 2005
Location:
Posted: 2nd Apr 2006 23:47
Yes, you are right. I did reposition the terrain as well as scale it, so I had to do some simple calculations to figure out what the coordinates on the original terrain were.

Login to post a reply

Server time is: 2024-11-19 05:31:27
Your offset time is: 2024-11-19 05:31:27