There a few ways of doing this, depending on which version of DB you have:
This one will work for DBPro:
sync on : sync rate 40 : autocam off
make matrix 1,1000,1000,20,20
make object cube 1,10
position object 1,500,5,500
radius# = 50
do
if leftkey() then angle# = wrapvalue(angle# + 1.0)
if rightkey() then angle# = wrapvalue(angle# - 1.0)
ox# = object position x(1)
oy# = object position y(1)
oz# = object position z(1)
` set position of camera
set camera to follow ox#,oy#,oz#,angle#,radius#,oy#+20,10,0
point camera ox#,oy#,oz#
sync
loop
The next two should work in all versions.
The first using NewXValue() and NewZValue()
sync on : sync rate 40 : autocam off
make matrix 1,1000,1000,20,20
make object cube 1,10
position object 1,500,5,500
radius# = 50
do
if leftkey() then angle# = wrapvalue(angle# + 1.0)
if rightkey() then angle# = wrapvalue(angle# - 1.0)
ox# = object position x(1)
oy# = object position y(1)
oz# = object position z(1)
` set position of camera
cx# = newxvalue(ox#,angle#,radius#)
cz# = newzvalue(oz#,angle#,radius#)
position camera cx#,oy# + 20,cz#
point camera ox#,oy#,oz#
sync
loop
...and this one shows the math version:
sync on : sync rate 40 : autocam off
make matrix 1,1000,1000,20,20
make object cube 1,10
position object 1,500,5,500
radius# = 50
do
if leftkey() then angle# = wrapvalue(angle# + 1.0)
if rightkey() then angle# = wrapvalue(angle# - 1.0)
ox# = object position x(1)
oy# = object position y(1)
oz# = object position z(1)
` set position of camera
cx# = radius# * sin(angle#) + ox#
cz# = radius# * cos(angle#) + oz#
position camera cx#,oy# + 20,cz#
point camera ox#,oy#,oz#
sync
loop
Hope this helps
Programming anything is an art, and you can't rush art.
Unless your name is Bob Ross, then you can do it in thirty minutes.