Noobs get stuck using MOVE OBJECT because it's hard to work out how to move an object forward in 3D space.
So I have written a function to do this
.
FUNCTION @move_object(ob_n, ob_px#, ob_pz#, ob_ay#, ob_spd#)
ob_px#= ob_px#+sin(ob_ay#)*ob_spd#
ob_pz#= ob_pz#+cos(ob_ay#)*ob_spd#
position object ob_n, ob_px#, 0, ob_pz#
ENDFUNCTION
Here's a working example
make object cone 1,1
xrotate object 1,90 : fix object pivot 1
hide mouse
sync on
position camera 0,20,-20
point camera px#,0,pz#
DO
px# = object position x(1)
pz# = object position z(1)
ay# = object angle y(1)
`control
if leftkey()= 1 then ay# = wrapvalue(ay#-3.6)
if rightkey()= 1 then ay# = wrapvalue(ay#+3.6)
if upkey()= 1 then @move_object(1, px#, pz#, ay#, 0.4)
`update rotation
yrotate object 1,ay#
sync
LOOP
FUNCTION @move_object(ob_n, ob_px#, ob_pz#, ob_ay#, ob_spd#)
ob_px#= ob_px#+sin(ob_ay#)*ob_spd#
ob_pz#= ob_pz#+cos(ob_ay#)*ob_spd#
position object ob_n, ob_px#, 0, ob_pz#
ENDFUNCTION
In programming, nothing exists