You can do realistic motion easily using velocities and acceleration.
Here's a pretty good program:
rem Activate manual sync
sync on
hide mouse
make matrix 1,10000,10000,25,25
load image "stoney01.bmp",1
prepare matrix texture 1,1,2,2
set matrix 1,1,1,0,1,1,1,1
dim hiLoad#(25,25)
load array "save.matrix", hiLoad#(0)
for x=0 to 25
for z=0 to 25
set matrix height 1,x,z, hiLoad#(x,z)*10
next z
next x
update matrix 1
undim hiLoad#(25,25)
make object sphere 1,100
rem Set variables for character position
x#=1000
z#=600
acc#=5
fog color rgb(128,128,128)
fog distance 9000
fog on
color backdrop rgb(128,128,128)
ink rgb(255,32,32),0
load cdmusic 2,1
set camera range 1,10000
rem Begin loop
do
`if music playing(1) = 0 then play music 1
rem Control camera with arrow keys
a#=wrapvalue(a#+10*(rightkey()-leftkey()))
push=upkey()-downkey()
pushX#=acc#*push*sin(a#)
pushZ#=acc#*push*cos(a#)
`fav=friction affected value
favX# = abs(slopeX())
favZ# = abs(slopeZ())
velX#=velX# + pushX# - slopeX() * favX#
velZ#=velZ# + pushZ# - slopeZ() * favZ#
if velX# > 80 then velX#=80
if velX# < -80 then velX#=-80
if velZ# > 80 then velZ#=80
if velZ# < -80 then velZ#=-80
x#=x#+velX#
z#=z#+velZ#
velX#=velX#*0.95
velZ#=velZ#*0.95
rem Update character
y#=get ground height(1,x#,z#)+50
position object 1,x#,y#,z#
yrotate object 1,a#
rem Position camera to the back of the character
cx#=newxvalue(x#,wrapvalue(a#+180),300)
cz#=newzvalue(z#,wrapvalue(a#+180),300)
cy#=get ground height(1,cx#,cz#)+100
position camera cx#,cy#,cz#
rem Point camera at object
point camera x#,y#,z#
text 1,1,str$(slopeX())
text 1,20,str$(slopeZ())
text 1,50,str$(velX#)
text 1,70,str$(velZ#)
rem Syncronise
sync
rem End loop
loop
function slopeX()
aY#=object angle y(1)
oX#=object position x(1)
oZ#=object position z(1)
oY# = get ground height(1,oX#,oZ#)
nY# = get ground height(1,oX#+4,oZ#)
slope# = nY#-oY#
endfunction slope#
function slopeZ()
aY#=object angle y(1)
oX#=object position x(1)
oZ#=object position z(1)
oY# = get ground height(1,oX#,oZ#)
nY# = get ground height(1,oX#,oZ#+4)
slope# = nY#-oY#
endfunction slope#
(Hope next bit works)
You'll need this file too ('save.matrix'):
ž
¶>ž
¶>ž
¶>ž
¶>ž
¶>ž
¶>ž
¶>ž
¶>ž
¶>ž
¶>ž
¶>ž
¶>ž
¶>ž
¶>ž
¶>ž
¶>ž
¶>ž
¶>ž
¶>ž
¶>ž
¶>ž
¶>ž
¶>ž
¶>ž
¶>ž
¶>ÞŠAÂÞŠAÂÞŠAÂÞŠAÂÞŠAÂÞŠAÂÞŠAÂÞŠAÂÞŠAÂÞŠAÂÞŠAÂÞŠAÂÞŠAÂÞŠAÂÞŠAÂÞŠAÂÞŠAÂÞŠAÂÞŠAÂÞŠAÂÞŠAÂÞŠAÂÞŠAÂÞŠAÂÞŠAÂÞŠAÂÂÏÀÂÂÏÀÂÂÏÀÂÂÏÀÂÂÏÀÂÂÏÀÂÂÏÀÂÂÏÀÂÂÏÀÂÂÏÀÂÂÏÀÂÂÏÀÂÂÏÀÂÂÏÀÂÂÏÀÂÂÏÀÂÂÏÀÂÂÏÀÂÂÏÀÂÂÏÀÂÂÏÀÂÂÏÀÂÂÏÀÂÂÏÀÂÂÏÀÂÂÏÀÂIýÃIýÃIýÃIýÃIýÃIýÃIýÃIýÃIýÃIýÃIýÃIýÃIýÃIýÃIýÃIýÃIýÃIýÃIýÃIýÃIýÃIýÃIýÃIýÃIýÃIýÃ+q;Ã+q;Ã+q;Ã+q;Ã+q;Ã+q;Ã+q;Ã+q;Ã+q;Ã+q;Ã+q;Ã+q;Ã+q;Ã+q;Ã+q;Ã+q;Ã+q;Ã+q;Ã+q;Ã+q;Ã+q;Ã+q;Ã+q;Ã+q;Ã+q;Ã+q;ÃúeÃúeÃúeÃúeÃúeÃúeÃúeÃúeÃúeÃúeÃúeÃúeÃúeÃúeÃúeÃúeÃúeÃúeÃúeÃúeÃúeÃúeÃúeÃúeÃúeÃúeÃb¬…Ãb¬…Ãb¬…Ãb¬…Ãb¬…Ãb¬…Ãb¬…Ãb¬…Ãb¬…Ãb¬…Ãb¬…Ãb¬…Ãb¬…Ãb¬…Ãb¬…Ãb¬…Ãb¬…Ãb¬…Ãb¬…Ãb¬…Ãb¬…Ãb¬…Ãb¬…Ãb¬…Ãb¬…Ãb¬…ÃÒÍ–ÃÒÍ–ÃÒÍ–ÃÒÍ–ÃÒÍ–ÃÒÍ–ÃÒÍ–ÃÒÍ–ÃÒÍ–ÃÒÍ–ÃÒÍ–ÃÒÍ–ÃÒÍ–ÃÒÍ–ÃÒÍ–ÃÒÍ–ÃÒÍ–ÃÒÍ–ÃÒÍ–ÃÒÍ–ÃÒÍ–ÃÒÍ–ÃÒÍ–ÃÒÍ–ÃÒÍ–ÃÒÍ–Ãú¯¥Ãú¯¥Ãú¯¥Ãú¯¥Ãú¯¥Ãú¯¥Ãú¯¥Ãú¯¥Ãú¯¥Ãú¯¥Ãú¯¥Ãú¯¥Ãú¯¥Ãú¯¥Ãú¯¥Ãú¯¥Ãú¯¥Ãú¯¥Ãú¯¥Ãú¯¥Ãú¯¥Ãú¯¥Ãú¯¥Ãú¯¥Ãú¯¥Ãú¯¥Ã²Ã²Ã²Ã²Ã²Ã²Ã²Ã²Ã²Ã²Ã²Ã²Ã²Ã²Ã²Ã²Ã²Ã²Ã²Ã²Ã²Ã²Ã²Ã²Ã²Ã²Ã¦Ü»Ã¦Ü»Ã¦Ü»Ã¦Ü»Ã¦Ü»Ã¦Ü»Ã¦Ü»Ã¦Ü»Ã¦Ü»Ã¦Ü»Ã¦Ü»Ã¦Ü»Ã¦Ü»Ã¦Ü»Ã¦Ü»Ã¦Ü»Ã¦Ü»Ã¦Ü»Ã¦Ü»Ã¦Ü»Ã¦Ü»Ã¦Ü»Ã¦Ü»Ã¦Ü»Ã¦Ü»Ã¦Ü»Ã?ÒÂÃ?ÒÂÃ?ÒÂÃ?ÒÂÃ?ÒÂÃ?ÒÂÃ?ÒÂÃ?ÒÂÃ?ÒÂÃ?ÒÂÃ?ÒÂÃ?ÒÂÃ?ÒÂÃ?ÒÂÃ?ÒÂÃ?ÒÂÃ?ÒÂÃ?ÒÂÃ?ÒÂÃ?ÒÂÃ?ÒÂÃ?ÒÂÃ?ÒÂÃ?ÒÂÃ?ÒÂÃ?ÒÂÃBáÆÃBáÆÃBáÆÃBáÆÃBáÆÃBáÆÃBáÆÃBáÆÃBáÆÃBáÆÃBáÆÃBáÆÃBáÆÃBáÆÃBáÆÃBáÆÃBáÆÃBáÆÃBáÆÃBáÆÃBáÆÃBáÆÃBáÆÃBáÆÃBáÆÃBáÆÃ:ùÇÃ:ùÇÃ:ùÇÃ:ùÇÃ:ùÇÃ:ùÇÃ:ùÇÃ:ùÇÃ:ùÇÃ:ùÇÃ:ùÇÃ:ùÇÃ:ùÇÃ:ùÇÃ:ùÇÃ:ùÇÃ:ùÇÃ:ùÇÃ:ùÇÃ:ùÇÃ:ùÇÃ:ùÇÃ:ùÇÃ:ùÇÃ:ùÇÃ:ùÇÃRÆÃRÆÃRÆÃRÆÃRÆÃRÆÃRÆÃRÆÃRÆÃRÆÃRÆÃRÆÃRÆÃRÆÃRÆÃRÆÃRÆÃRÆÃRÆÃRÆÃRÆÃRÆÃRÆÃRÆÃRÆÃRÆû?Áû?Áû?Áû?Áû?Áû?Áû?Áû?Áû?Áû?Áû?Áû?Áû?Áû?Áû?Áû?Áû?Áû?Áû?Áû?Áû?Áû?Áû?Áû?Áû?Áû?ÁÃ臹Ã臹Ã臹Ã臹Ã臹Ã臹Ã臹Ã臹Ã臹Ã臹Ã臹Ã臹Ã臹Ã臹Ã臹Ã臹Ã臹Ã臹Ã臹Ã臹Ã臹Ã臹Ã臹Ã臹Ã臹Ã臹ÃM¯ÃM¯ÃM¯ÃM¯ÃM¯ÃM¯ÃM¯ÃM¯ÃM¯ÃM¯ÃM¯ÃM¯ÃM¯ÃM¯ÃM¯ÃM¯ÃM¯ÃM¯ÃM¯ÃM¯ÃM¯ÃM¯ÃM¯ÃM¯ÃM¯ÃM¯ÃÞô¡ÃÞô¡ÃÞô¡ÃÞô¡ÃÞô¡ÃÞô¡ÃÞô¡ÃÞô¡ÃÞô¡ÃÞô¡ÃÞô¡ÃÞô¡ÃÞô¡ÃÞô¡ÃÞô¡ÃÞô¡ÃÞô¡ÃÞô¡ÃÞô¡ÃÞô¡ÃÞô¡ÃÞô¡ÃÞô¡ÃÞô¡ÃÞô¡ÃÞô¡Ãšs’Ús’Ús’Ús’Ús’Ús’Ús’Ús’Ús’Ús’Ús’Ús’Ús’Ús’Ús’Ús’Ús’Ús’Ús’Ús’Ús’Ús’Ús’Ús’Ús’Ús’åÀåÀåÀåÀåÀåÀåÀåÀåÀåÀåÀåÀåÀåÀåÀåÀåÀåÀåÀåÀåÀåÀåÀåÀåÀåÀÃæPZÃæPZÃæPZÃæPZÃæPZÃæPZÃæPZÃæPZÃæPZÃæPZÃæPZÃæPZÃæPZÃæPZÃæPZÃæPZÃæPZÃæPZÃæPZÃæPZÃæPZÃæPZÃæPZÃæPZÃæPZÃæPZæÙ/æÙ/æÙ/æÙ/æÙ/æÙ/æÙ/æÙ/æÙ/æÙ/æÙ/æÙ/æÙ/æÙ/æÙ/æÙ/æÙ/æÙ/æÙ/æÙ/æÙ/æÙ/æÙ/æÙ/æÙ/æÙ/ÃŽÃÃŽÃÃŽÃÃŽÃÃŽÃÃŽÃÃŽÃÃŽÃÃŽÃÃŽÃÃŽÃÃŽÃÃŽÃÃŽÃÃŽÃÃŽÃÃŽÃÃŽÃÃŽÃÃŽÃÃŽÃÃŽÃÃŽÃÃŽÃÃŽÃÃŽÃÃ7u§Â7u§Â7u§Â7u§Â7u§Â7u§Â7u§Â7u§Â7u§Â7u§Â7u§Â7u§Â7u§Â7u§Â7u§Â7u§Â7u§Â7u§Â7u§Â7u§Â7u§Â7u§Â7u§Â7u§Â7u§Â7u§ÂëÈ
ÂëÈ
ÂëÈ
ÂëÈ
ÂëÈ
ÂëÈ
ÂëÈ
ÂëÈ
ÂëÈ
ÂëÈ
ÂëÈ
ÂëÈ
ÂëÈ
ÂëÈ
ÂëÈ
ÂëÈ
ÂëÈ
ÂëÈ
ÂëÈ
ÂëÈ
ÂëÈ
ÂëÈ
ÂëÈ
ÂëÈ
ÂëÈ
ÂëÈ
Â