*still confused* Well, here's a small snippet of code from the Tank demo, the part that supposedly does this:
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#-mx#,frontleftz#-mz#)
frontrighth#=get ground height(1,frontrightx#-mx#,frontrightz#-mz#)
backlefth#=get ground height(1,backleftx#-mx#,backleftz#-mz#)
backrighth#=get ground height(1,backrightx#-mx#,backrightz#-mz#)
across#=((frontrighth#-frontlefth#)+(backrighth#-backlefth#))/2.0
length#=((backlefth#-frontlefth#)+(backrighth#-frontrighth#))/2.0
rem Update tank model
h#=get ground height(1,x#-mx#,z#-mz#)
trackh#=(frontlefth#+frontrighth#+backlefth#+backrighth#)/4.0
if trackh#>h# then h#=trackh#
position object 1,x#,h#,z#
yrotate object 1,a#
rotate object 2,wrapvalue(length#/4.0),0,wrapvalue(across#/4.0)
Hopefully that will come out right when I post this. But anyway, there it is, if you can make sense out of it.