graphics3d 800,600,32,2 camera=createcamera() avatar=createcube() terrain=loadterrain("your height map goes here") ;scale the terrain appropriately, I am sure you know how to do this... entitypickmode terrain,2 ;define startx#,startz# as some position on your terrain positionentity avatar,startx#,terrainy(terrain,startx,0,startz),startz# positionentity camera,entityx(avatar),entityy(avatar)+10,entityz(avatar)-10 pointentity camera,avatar targetx#=startx targetz#=startz repeat if mousehit(1)>0 then if camerapick(camera,mousex(),mousey())>0 then targetx#=pickedx() targetz#=pickedz() endif endif if sqr((targetx-startx)^2+(targetz-startz)^2)>1.0 then rotateentity avatar,0,vectoryaw(targetx-startx,0,targetz-startz),0 moveentity avatar,0,0,0.5 positionentity avatar,entityx(avatar),terrainy(terrain,entityx(avatar),0,entityz(avatar)),entityz(avatar) positionentity camera,entityx(avatar),entityy(avatar)+10,entityz(avatar)-10 pointentity camera,avatar endif startx=entityx(avatar) startz=entityz(avatar) updateworld renderworld flip until keydown(1)
There is some basic code to get you started