I want to have the camera zoom down to the object in a smooth path when I press the space key, all I can do is to have the camera jump from one position to the next.Please help
`setup everything
cls
sync on
sync rate 60
make object cube 1,20
position object 1,500,10,200
color object 1,rgb(255,255,0)
make matrix 1,1000,1000,32,32
x#=500
y#=10
z#=20
unitselected=0
movecam=0
do
`move screen with mouse
if MOUSEX() = 0 then position camera 0,camera position x()-4,camera position y(),camera position z()
if MOUSEX() = SCREEN WIDTH()-1 then position camera 0,camera position x()+4,camera position y(),camera position z()
if MOUSEY() = 0 then position camera 0,camera position x(),camera position y(),camera position z()+4
if MOUSEY() = SCREEN HEIGHT()-1 then position camera 0,camera position x(),camera position y(),camera position z()-4
`smoothly zoom camera to selected object and allow keyboard control of that object
if spacekey()=1 then movecam=1
color object 1,rgb(200,0,0)
if movecam=1
a#=wrapvalue(a#+1)
position camera 10,500+(sin(a#)*500),100
point camera 1,0,500
gosub moveunitkey:
endif
`frames per second
text 20,screen height()-40,desc$
fps$="DBPro Fps: "+str$(screen fps())
text screen width()-20-text width(fps$),screen height()-40,fps$
sync
loop
`control unit
moveunitkey:
if upkey()=1 then x#=newxvalue(x#,b#,5) : z#=newzvalue(z#,b#,5)
if downkey()=1 then x#=newxvalue(x#,b#,-5) : z#=newzvalue(z#,b#,-5)
if leftkey()=1 then b#=wrapvalue(b#-4)
if rightkey()=1 then b#=wrapvalue(b#+4)
rem Update units position
y#=get ground height(1,x#,z#)+5.0
position object 1,x#,y#,z#
yrotate object 1,b#
rem Position camera to the back of the character
cx#=newxvalue(x#,wrapvalue(b#+180),300)
cz#=newzvalue(z#,wrapvalue(b#+180),300)
cy#=get ground height(1,cx#,cz#)+100.0
position camera cx#,cy#,cz#
rem Point camera at object
point camera x#,y#,z#
return