Hi there.
@Nathan C
Van B has given you a complete example of how to walk on an advanced terrain.Yestarday night,(in canary islands), my wife call me finally...she do it from time to time
and I didnĀ“t see your example until right now.
Here I show you how to walk and how to collide with the terrain(we don`t collide exactly...we just check if four points around us are higher than us, and then we stop in that direction).
Download the complete example.
cheers.
sync on
backdrop on
autocam off
set camera range 0.5, 30000
x#=200
z#=200
` Carga las texturas base y de detalle
load image "terreno.jpg", 1
load image "detail.tga", 2
make object terrain 1
set terrain heightmap 1, "elevacionT.bmp"
set terrain scale 1, 5, 0.3, 5
set terrain split 1, 16
set terrain tiling 1, 4
set terrain light 1,-1,-1,-21, 0.9,0.7,0.7,0 ` luz - direccionX, direccionY, direccionZ, rojo, verde, azul, intensidad
set terrain texture 1, 1, 2
build terrain 1
position camera x,23,z
veloc#=0.07
do
set cursor 5,5
print
print x#
print y#
print z#
print "fps = " + str$ ( screen fps ( ) )
if upkey()=1 THEN x#=NEWXVALUE(x#,a#,veloc#):z#=NEWZVALUE(z#,a#,veloc#)
if downkey()=1 THEN x#=NEWXVALUE(x#,a#,-veloc#):z#=NEWZVALUE(z#,a#,-veloc#)
a#=wrapvalue(a#+mousemovex()/2)
cam#=wrapvalue(cam#+mousemovey()/2)
rotate camera cam#,a#,0
y#=get terrain ground height(1,x#,z#)
`NOS ASEGURAMOS QUE NO PODEMOS PASAR POR LAS INCLINACIONES FUERTES
`HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
xd#=get terrain ground height(1,x#+25,z#)
xi#=get terrain ground height(1,x#-25,z#)
zf#=get terrain ground height(1,x#,z#+25)
zb#=get terrain ground height(1,x#,z#-25)
`forzamos que si nuestros sensores estan mas altos, nos hace frenar
` aumentado o disminuyendo las x# z# de nuestra posicion
if xd#>y#+18 then dec x#,veloc#
if xi#>y#+18 then inc x#,veloc#
if zf#>y#+18 then dec z#,veloc#
if zb#>y#+18 then inc z#,veloc#
`HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
position camera x#,y#+5,z#
sync
loop
I'm not a grumpy grandpa