Hi Gadget,
I'm a little surprised you posted this here. Anyway, this code will at least get you to where you can see the terrain and tank. It comes out looking pretty dark. Also, your Terrain Test.bmp is 65 X 65. You want maps to be multiples of 2. I resized it to 256 X 256 (file attached). The tank is huge, so I scaled it down a bit. I really didn't have time to comment on the code too much.
Rem Project: Terrain Test2
Rem Created: Tuesday, June 29, 2010
`set display mode 800,600,32
sync on
sync rate 60
autocam off
color backdrop 0,0
set text font "Arial"
set text size 12
set text transparent
autocam off : backdrop on : color backdrop rgb(0,75,200)
set camera range 1.0, 9200.0 : hide mouse
gosub BuildTerrain
x# = camera position x() : z# =camera position z()
y# = get terrain ground height(1,x#,z#)
position camera x#,y# + 200,z#
load object "media\tank1.dbo",2
scale object 2,10.0,10.0,10.0
global os# as float : os# = object size y(2) * .05
x# = object position x(2) : z# =object position z(2)
y# = get terrain ground height(1,x#,z#)
position object 2,x#,y# + (object size y(2)/2),z#
MoveTank(1)
`main loop starts here
do
MoveTank(mouseclick())
update terrain 1
debug()
sync
loop
end
`functions start here
function MoveTank(mc)
moved = 0
if mc = 1 then moved = 1 : move object 2,5.0
if mc = 2 then moved = 2 : move object 2,-5.0
if moved > 0
x# = object position x(2)
z# = object position z(2)
y# = get terrain ground height(1,x#,z#)
position object 2,x#,y# + os#,z#
position camera x#,y# + 175.0,z#
move camera - 350 : point camera x#,y#,z#
yrotate object 2,object angle y(2) + (mousemovex() * .3)
set camera to object orientation 2
endif
endfunction
function Debug()
text 10,10,"FPS: " + str$(screen fps())
endfunction
BuildTerrain:
load image "media\clumpy_grass.jpg",1
load image "media\base4.jpg",2
make object terrain 1 ` create the terrain object
set terrain heightmap 1, "media\Terrain Test.bmp" ` set the heightmap
set terrain scale 1, 200, 20, 200 ` set the scale
set terrain split 1, 8 ` split value by 32 * 32
set terrain tiling 1, 8 ` detail map tiling
set terrain light 1, 1, 1, 1, 1.0, 1.0, 1.0, 0.7 ` light - xdir, ydir, zdir, red, green, blue, intensity
set terrain texture 1, 1, 2 ` base and detail texture
build terrain 1
position object 1,-5000.0,0.0,-5000.0
return
LMB moves the tank forward (the camera follows), RMB moves it back. Mousemove rotates it on the Y axis.
It's not perfect, in that you really would have to look at the terrain height on the four corners of the tank and calculate the proper angle it should be, but it hopefully will be of help to you.