x#=camera position x()
z#=camera position x()
y#=camera position y()
oldx#=camera position x()
oldz#=camera position z()
oldy#=camera position y()
ph#=get ground height(1,x#,z#)+50
ph2#= get ground height(1,x#,z#)+50
if ph2#>ph#
position camera oldx#,oldy#,oldz#
endif
Is your code. But did you move between the data collection?
It should be something like this:
`in the loop
oldposx# = camera position x()
oldposz# = camera position z()
`>>>>> HERE YOU HAVE TO MOVE <<<<<<
if upkey() > 0 then move camera 1
if downkey() > 0 then move camera -1
if leftkey() > 0 then turn camera left 1
if rightkey() > 0 then turn camera right 1
`Recollect data
posx# = camera position x()
posz# = camera position z()
`And then your height things.
`Old data
OldHeight# = get ground height(1, oldposx#, oldposz#) + 50
`New data
NewHeight# = get ground height(1, posx#, posz#) + 50
`Position camera
position camera posx#, NewHeight#, posz#
`If the height difference bigger is than the maximum steepness, then reset the position
if abs(OldHeight#-NewHeight#) > 0.75 then position camera oldposx#, OldHeight#, oldposz#
Good luck.
It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.