This prints your 3d object
& the camera xyz position onto the screen. Useful if you want to put a camera in a specific location, but don't know the coords. The camera moves on keys & the xyz position updates. The cube always stays at 0,0,0.
This took me a while to figure out how to put the code in the right order to place the text over the 3d & may, also, be useful if you want to do the same.
n.b. keystates (the camera z-axis) a=30, z=44. This may be different on your machine.
rem camera position
px=16
x#=0
y#=0
z#=-10
sync on
sync rate 60
hide mouse
backdrop on
color backdrop 0,black
autocam on
make object cube 1,1
position object 1,0,0,0
point camera 0,0,0,0
set camera view 0,0,0,(screen width()),(screen height())
cls
do
x$=left$(str$(x#),5)
y$=left$(str$(y#),5)
z$=left$(str$(z#),5)
text 0,(0*px),"x-keys: cursor left/right"
text 0,(1*px),"y-keys: cursor up/down"
text 0,(2*px),"z-keys: a/z"
text 0,(3*px),"x="+x$
text 0,(4*px),"y="+y$
text 0,(5*px),"z="+z$
if leftkey()=1 then x#=x#-0.1
if rightkey()=1 then x#=x#+0.1
if upkey()=1 then y#=y#+0.1
if downkey()=1 then y#=y#-0.1
if keystate(30)=1 then z#=z#+0.1
if keystate(44)=1 then z#=z#-0.1
position camera 0,x#,y#,z#
sync
loop
The same code with camera rotation added...
px=16
x#=0
y#=0
z#=-10
cx#=0
cy#=0
cz#=0
sync on
sync rate 60
hide mouse
backdrop on
color backdrop 0,black
autocam on
make object cube 1,1
position object 1,0,0,0
set camera view 0,0,0,(screen width()),(screen height())
cls
do
x$=left$(str$(x#),5)
y$=left$(str$(y#),5)
z$=left$(str$(z#),5)
cx$=left$(str$(cx#),5)
cy$=left$(str$(cy#),5)
cz$=left$(str$(cz#),5)
text 0,(0*px),"keys to xyz position camera"
text 0,(1*px),"shift+keys to xyz rotate camera"
text 0,(2*px),"x-keys: cursor left/right"
text 0,(3*px),"y-keys: cursor up/down"
text 0,(4*px),"z-keys: a/z"
text 0,(5*px),"x-pos="+x$
text 0,(6*px),"y-pos="+y$
text 0,(7*px),"z-pos="+z$
text 0,(8*px),"x-rot="+cx$
text 0,(9*px),"y-rot="+cy$
text 0,(10*px),"z-rot="+cz$
if shiftkey()=0 and leftkey()=1 then x#=x#-0.1
if shiftkey()=0 and rightkey()=1 then x#=x#+0.1
if shiftkey()=0 and upkey()=1 then y#=y#+0.1
if shiftkey()=0 and downkey()=1 then y#=y#-0.1
if shiftkey()=0 and keystate(30)=1 then z#=z#+0.1
if shiftkey()=0 and keystate(44)=1 then z#=z#-0.1
if shiftkey()=1 and leftkey()=1 then cx#=cx#-0.1
if shiftkey()=1 and rightkey()=1 then cx#=cx#+0.1
if shiftkey()=1 and upkey()=1 then cy#=cy#+0.1
if shiftkey()=1 and downkey()=1 then cy#=cy#-0.1
if shiftkey()=1 and keystate(30)=1 then cz#=cz#+0.1
if shiftkey()=1 and keystate(44)=1 then cz#=cz#-0.1
if cx#<0 then cx#=360
if cx#>360 then cx#=0
if cy#<0 then cy#=360
if cy#>360 then cy#=0
if cz#<0 then cz#=360
if cz#>360 then cz#=0
position camera 0,x#,y#,z#
rotate camera 0,cx#,cy#,cz#
sync
loop
I have an XP3000+, 1.5gb DDR333, a 6600GT and I'm programming 3k text-based exe's?!