Hi Algae Man,
I took the time and dug out an old piece of code I used. I am sure I did find it in the old DB website, if not on a website linked to it.
Study the code in the function It negotiates with two angles and a zoom for the x,y and z value respectivly to position object 1000 in relation to an object, called the observed object.
The main loop does read the mouse movement and alters the position of the object 1000, as well as clicking status
It does have a
lock problem being with EULER Maths. What you can do is find a way to avoid and resolve the lock in the function.
remstart
THESE ARE JUST ABSTRACTS OF MY CODE
I DON'T HAVE DB COMPILER HERE IN THE OFFICE
SO IF YOU WANT A COMPLETE DEMO PLEASE WAIT...
remend
`Camera start position and range.
Set Camera Range 1,3000
make object sphere 1000,10
position object 1000,0,0,0
`Make an Observed object or two
`you know how
`And then you need the main loop
Loop
li_free = 1
`Control ship/Camera.
if MOUSECLICK() = 2
li_free = 0
li_zoom# = li_zoom# + mousemovey()
if li_zoom# < 0 then li_zoom# = 0
if li_zoom# > 1000 then li_zoom# = 1000
endif
if MOUSECLICK() = 1
li_free = 0
a#=wrapvalue(a# + mousemovex() )
b#=wrapvalue(b# + mousemovey() )
endif
If li_free = 1
mousex# = mousex()
mousey# = mousey()
`make a mouse cross
ink RGB(255,255,255), 0
Line mousex#-5, mousey#, mousex#+5, mousey#
Line mousex#, mousey#-5, mousex#, mousey#+5
endif
PositionCamera(a#, b#, li_zoom#, li_observed)
DO
END
`And the Function
function PositionCamera(a#, b#, ai_zoom#, ai_observed)
`find object to look
li_curX# = glb_mapSystemDef(ai_observed, 2)
li_curY# = glb_mapSystemDef(ai_observed, 3)
li_curZ# = glb_mapSystemDef(ai_observed, 4)
`position camera
CaX# = li_curX# + (sin(a#)*cos(b#)*ai_zoom#)
CaY# = li_curY# + (sin(b#)*ai_zoom#)
CaZ# = li_curZ# + (cos(a#)*cos(b#)*ai_zoom#)
`Rotate camera 0, 0, 0
Position Object 1000, CaX#, CaY#, CaZ#
Position Camera CaX#, CaY#, CaZ#
POINT OBJECT 1000, li_curX#, li_curY#, li_curZ#
set camera to object orientation 1000
endfunction
I hope it helps to see what's going on there...
I know how it feels to be working with something for a long time and still feel a newbie. sometimes we postpone our in depth study of a subject just for the sake of using, prototyping and getting something up and running quick. And then we worry how it works.
Isn't it weird?
-------------------------------
Pointy birds, Oh pointy pointy
Anoint my head, Anointy 'nointy