Maybe you can do with this piece of code. Courtesy of Phaelax, Re_Eye and who else more
set display mode 1024,768,32
REM -- MATRIX
REM -- Simple curved matrix
make matrix 1,1024,1024,32,32
position matrix 1,0,0,0
for x = 12 to 32
counter# = curvevalue(500, counter# ,20)
for y = 0 to 32
set matrix height 1,x,y,counter#
next x
next y
update matrix 1
REM -- PLAYER
rem -- TILT OBJECT
make object cone 1,20
REM -- PLAYER OBJECT
make object box 100,15,5,30
glue object to limb 100,1,0
REM -- PLAYER VARS
global spd#
spd# = 0
spd_max# = 5
do
REM -- PLAYER STUFF
gosub PLAYER_CONTROL
Tilt(1,100,1,a#,x#,z#,20)
REM -- OTHER PRINT STUFF
set cursor 0,0
print SCREEN FPS()
print spd#
REM -- CAMERA FOLLOWS PLAYER
set camera to follow x#,y#,z#,a#,150,70,10,0
loop
PLAYER_CONTROL:
x#=object position x(1)
y#=object position y(1)
z#=object position z(1)
a#=object angle y(1)
if upkey()=1
if spd# < spd_max#
spd# = curvevalue(spd_max#, spd#, 200)
endif
x#=newxvalue(x#,a#,spd#)
z#=newzvalue(z#,a#,spd#)
else
spd# = curvevalue(0, spd#, 100)
x#=newxvalue(x#,a#,spd#)
z#=newzvalue(z#,a#,spd#)
endif
if leftkey()=1 then a#=a#-2
if rightkey()=1 then a#=a#+2
Return
Function Tilt(MatNum,Obj,LimbObj,a#,x#,z#,foot#)
REM -- This function was altered by Red_Eye
REM -- I only did some tweaking (altering values and removing unused stuff ;-)
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(MatNum,frontleftx#,frontleftz#)
frontrighth#=get ground height(MatNum,frontrightx#,frontrightz#)
backlefth#=get ground height(MatNum,backleftx#,backleftz#)
backrighth#=get ground height(MatNum,backrightx#,backrightz#)
across#=((frontrighth#-frontlefth#)+(backrighth#-backlefth#))/1.0
length#=((backlefth#-frontlefth#)+(backrighth#-frontrighth#))/1.0
rem Update tank model
h#=get ground height(MatNum,x#,z#)
trackh#=(frontlefth#+frontrighth#+backlefth#+backrighth#)/4.0
if trackh#>h# then h#=trackh#
REM -- GRAVITY STARTS HERE
REM -- You may have to tweak it to suit your own model
if spd# > 0
REM -- Changes the speed
if length# > 0
inc spd#,0.025
endif
if length# < 0
dec spd#,0.0025
endif
REM -- Changes the angle
if across# > 0
a#=a#-0.35
endif
if across# < 0
a#=a#+0.35
endif
endif
REM -- GRAVITY ENDS HERE
REM -- UPDATE PLAYER
position object LimbObj,x#,h#,z#
yrotate object LimbObj,a#
rotate object Obj,wrapvalue(length#/1.0),0,wrapvalue(across#/1.0)
EndFunction
function get_ground_height(level,object)
ox# = object position x(object)
oy# = object position y(object)
oz# = object position z(object)
dis# = intersect object(level,ox#,oy#,oz#,ox#,oy#-10000,oz#)
endfunction dis#
Function TiltObj(level,Obj,LimbObj,a#,x#,z#,foot#)
REM -- This function was altered by Red_Eye
REM -- I only did some tweaking (altering values and removing unused stuff ;-)
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#)
oy# = object position y(1)
rem Calculate degree of tilting from corner heights
frontlefth#=intersect object(level,frontleftx#,oy#,frontleftz#,frontleftx#,oy#-10000,frontleftz#)
frontrighth#=intersect object(level,frontrighthx#,oy#,frontrighthz#,frontrighthx#,oy#-10000,frontrighthz#)
backlefth#=intersect object(level,backleftx#,oy#,backleftz#,backleftx#,oy#-10000,backleftz#)
backrighth#=intersect object(level,backrighthx#,oy#,backrighthz#,backrighthx#,oy#-10000,backrighthz#)
across#=((frontrighth#-frontlefth#)+(backrighth#-backlefth#))/1.0
length#=((backlefth#-frontlefth#)+(backrighth#-frontrighth#))/1.0
rem Update tank model
h#=intersect object(level,x#,oy#,z#,x#,oy#-10000,z#)
trackh#=(frontlefth#+frontrighth#+backlefth#+backrighth#)/4.0
if trackh#>h# then h#=trackh#
print backleft#
print backright#
print frontleft#
print frontright#
print h#
position object LimbObj,x#,h#,z#
EndFunction