i dont know why i posted that here ...but
im not new DB....anyway ...i understand all the code here except some part...i commented the code...
rem calculate the X and Z of 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 he seem to calculate the height of each corner
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#)
rem here he seem to calculate the average of the....the height between 2 corner..it make sens...
across#=((frontrighth#-frontlefth#)+(backrighth#-backlefth#))/2.0
length#=((backlefth#-frontlefth#)+(backrighth#-frontrighth#))/2.0
rem here he check if the tank model is lower than the landscape if yes he .....
h#=get ground height(1,x#-mx#,z#-mz#)
trackh#=(frontlefth#+frontrighth#+backlefth#+backrighth#)/4.0
if trackh#>h# then h#=trackh#
rem here he position the object corectly and rotate it on y axis
position object 1,x#,h#,z#
yrotate object 1,a#
rem but HERE is the....im so confuse...
rem rotate object 2,wrapvalue(length#/4.0),0,wrapvalue(across#/4.0)
the lines who should be here are something like...
rem i take simple pytagore math...and trygonometry to find the real angle..
az#=wrapvalue(asin(across#/sqrt(2*110^2)))
ax#=wrapvalue(asin(length#/sqrt(2*110^2)))
rotate object 2,ax#,0,az#
rem try to replay the last line by MY 3 line...it work very well like the original line...damn im so proud lol...it work the first time
..i CANT figure how the original line work!!!
ho and it the Tank demo 2 in DB
and the line to replace is the line #276 or close to it..
plz help me...