I just wrote some code to do that a few days ago.
distance as float
speed as float
speed =.1
sync on
autocam off
position camera 25,25,-25
point camera 0,0,0
`make planet
make object sphere 1,20
color object 1, rgb(128,128,128)
position object 1, 0,0,0
`make vehicle
make object cone 2,1
rotate object 2, -90,00,00
fix object pivot 2
color object 2, rgb(255,0,0)
SET OBJECT CULL 2,0
position object 2, 0,0,0
`land on the planet by picking a spot (x,y,z).
`point the vehicle toward that spot, then pitch down 90 degrees
point object 2, 25,25,-25
pitch object down 2, 90
do
text 5,5, "Use numeric keypad to move: 8,2: forward/reverse. 4,6: turn. 1,3: strafe"
`always start the vehicle at the center of the planet
position object 2, 0,0,0
`strafe vehicle
if keystate(79) then roll object left 2,speed
if keystate(81) then roll object right 2,speed
`forward/reverse
if keystate(72) then pitch object up 2,speed
if keystate(80) then pitch object down 2,speed
`turn vehicle
if keystate(75) then turn object left 2,speed
if keystate(77) then turn object right 2,speed
`when finished rotating the vehicle, move it to the surface
move object up 2, 11
distance=intersect object(1, 0,0,0, object position x(2), object position y(2), object position z(2))
move object down 2, (10.5-distance)
sync
loop
And here it is with a 3rd person camera
distance as float
speed as float
speed =.1
sync on
autocam off
position camera 25,25,-25
point camera 0,0,0
`make planet
make object sphere 1,20
color object 1, rgb(128,128,128)
position object 1, 0,0,0
`make vehicle
make object cone 2,1
rotate object 2, -90,00,00
fix object pivot 2
color object 2, rgb(255,0,0)
SET OBJECT CULL 2,0
position object 2, 0,0,0
`land on the planet by picking a spot (x,y,z).
`point the vehicle toward that spot, then pitch down 90 degrees
point object 2, 25,25,-25
pitch object down 2, 90
do
text 5,5, "Use numeric keypad to move: 8,2: forward/reverse. 4,6: turn. 1,3: strafe"
`always start the vehicle at the center of the planet
position object 2, 0,0,0
`strafe vehicle
if keystate(81) then roll object left 2,speed
if keystate(79) then roll object right 2,speed
`forward/reverse
if keystate(72) then pitch object up 2,speed
if keystate(80) then pitch object down 2,speed
`turn vehicle
if keystate(75) then turn object left 2,speed
if keystate(77) then turn object right 2,speed
`when finished rotating the vehicle, move it to the surface
move object up 2, 11
distance=intersect object(1, 0,0,0, object position x(2), object position y(2), object position z(2))
move object down 2, (10.5-distance)
position camera object position x(2)*2,object position y(2)*2,object position z(2)*2
set camera to object orientation 2
move camera 10
pitch camera up 30
turn camera left 180
sync
loop