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.

DarkBASIC Professional Discussion / Get Ground Height

Author
Message
Shining Moonblade
23
Years of Service
User Offline
Joined: 2nd Oct 2002
Location:
Posted: 22nd Apr 2003 16:44
Is there a problem with Get Ground Height in DBPro 4? Sometimes it works, othertimes my model is buried halfway in it. I'm using the right matrix and coords....
The moon empowers my blade and commands me to destroy you all!
UberTuba
23
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Brittania
Posted: 22nd Apr 2003 16:52
ive never had a problem. Is it only buried on steep slopes or something.

Life is a terminal disease.
You never survive it.
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 22nd Apr 2003 18:11
I think it would help if you got the heights from the 4 corners (as well as the middle), and then tilt/raise the model over the average...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Shining Moonblade
23
Years of Service
User Offline
Joined: 2nd Oct 2002
Location:
Posted: 22nd Apr 2003 20:17
Yeah, actually, it buries itself whenever I'm going over something steep. (I used the Randomize matrix command, so it's kinda different every time...)

@ MrTaToad
How do I do that? Use math (divide my position by the width of the tile, using an integer value) or is there some commandset I don't know about?

The moon empowers my blade and commands me to destroy you all!
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 23rd Apr 2003 00:58
I think you would need to find the object size (and thus you would be able to work out each of the four corners). Alternatively you could do a checklist for 4/5 limbs, and get the positions for each of those.

It would be nice to be able to get each limb size...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Scorpyo
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 23rd Apr 2003 01:39
rem Calculate four X+Z coordinates for each corner
foot#=110
ta#=wrapvalue(a#-45)
frontleftx#=newxvalue(x#,ta#,foot#) : frontleftz#=newzvalue(z#,ta#,foot#)
ta#=wrapvalue(a#+45)
frontrightx#=newxvalue(x#,ta#,foot#) : frontrightz#=newzvalue(z#,ta#,foot#)
ta#=wrapvalue(a#+225)
backleftx#=newxvalue(x#,ta#,foot#) : backleftz#=newzvalue(z#,ta#,foot#)
ta#=wrapvalue(a#+135)
backrightx#=newxvalue(x#,ta#,foot#) : backrightz#=newzvalue(z#,ta#,foot#)

rem Calculate degree of tilting from corner heights
frontlefth#=get ground height(1,frontleftx#,frontleftz#)
frontrighth#=get ground height(1,frontrightx#,frontrightz#)
backlefth#=get ground height(1,backleftx#,backleftz#)
backrighth#=get ground height(1,backrightx#,backrightz#)
across#=((frontrighth#-frontlefth#)+(backrighth#-backlefth#))/2.0
length#=((backlefth#-frontlefth#)+(backrighth#-frontrighth#))/2.0

xrotate object 1,wrapvalue(length#/4.0)
zrotate object 1,wrapvalue(across#/4.0)

x#=newxvalue(x#,a#,s#)
z#=newzvalue(z#,a#,s#)
h#=get ground height(1,x#,z#)
position object 1,x#,h#,z#
yrotate object 1,a#

if upkey()=1 and s#<8 then s#=s#+1
if downkey()=1 and s#>-8 then s#=s#-1
if leftkey()=1 then a#=wrapvalue(a#-4)
if rightkey()=1 then a#=wrapvalue(a#+4)

Login to post a reply

Server time is: 2026-07-10 19:48:15
Your offset time is: 2026-07-10 19:48:15