>Now you have me curious .. what IS the effect you want?
Well take the code I posted above and run it with regular dark basic (not pro) to see. And if you want, take out all the apparatusdummy (the attempted workaround) junk and just turn and pitch the apparatus object (silly name in the demo I know, was just copied from some code where it made sense =)
The way it worked, and should work in dbpro, was that you could use the arrow keys to rotate the 3D pointer in a fairly intuitive manner - the camera position helps to make it intuitive since the left arrow key always moves left, and the down arrow key always moves down, etc. Your code above doesn't truely 'turn left' around the up vector of the object which results in very tight little cicles when the object is pitched up to near 90.
>...unfortunately the camera can't follow also z rotated. It has to stay z= 0. or things go badly awry.
With the camera code in my above example you should be able to roll with the camera no problem... Just didn't make a key for it since it wasn't needed.
Rich from db, do you read this forum? Is there a known way to work around this in the demo? I want to finish the game I'm working on! =)
Here, I decided to add the code again with a few edits (including roll) and without the workaround that didn't work...
` Smooth camera transition example
` Joseph J. Schmoe - 2003 =)
` NOTE: there is a bug in the Dark Basic Pro demo that stops this from working =(
sync on
sync rate 0
apparatus = 1
pointer = 2
make object box apparatus, 10,10,40
color object apparatus, rgb(255,255,255)
make object triangle pointer, -10, 0, 0, 0, 0, 40, 10, 0, 0
color object pointer, rgb(255,0,0)
` make some extra stuff to give perspective to camera
make object cube 3, 40
position object 3, 30,20,200
color object 3, rgb(255,255,0)
make object cube 4, 40
position object 4, 100,20,0
color object 4, rgb(0,255,0)
camspeed# = 20
keyspeed# = 2.0
done = 0
camholdon = 1
repeat
if KEYSTATE(203)
` turn left
turn object left apparatus, keyspeed#
holdcamera = 1
else
if KEYSTATE(205)
` turn right
turn object right apparatus, keyspeed#
holdcamera = 1
endif
endif
if KEYSTATE(200)
` pitch down
pitch object down apparatus, keyspeed#
holdcamera = 1
else
if KEYSTATE(208)
` pitch up
pitch object up apparatus, keyspeed#
holdcamera = 1
endif
endif
if KEYSTATE(211)
` roll left - delete key
roll object left apparatus, keyspeed#
holdcamera = 1
else
if KEYSTATE(209)
` roll right - page down key
roll object right apparatus, keyspeed#
holdcamera = 1
endif
endif
if KEYSTATE(57)
if camholdon
camholdon = 0
else
camholdon = 1
endif
endif
text 1,40, "Arrow keys to rotate, Del/PgDn to roll, space bar toggles camera hold..."
if camholdon = 0
holdcamera = 0
text 1,60, "Cam hold OFF"
else
text 1,60, "Cam hold *ON*"
endif
set object to object orientation pointer, apparatus
if (holdcamera = 0)
cx# = camera position x()
cy# = camera position y()
cz# = camera position z()
cax# = camera angle x()
cay# = camera angle y()
caz# = camera angle z()
aax# = object angle x(apparatus)
aay# = object angle y(apparatus)
aaz# = object angle z(apparatus)
position camera object position x(apparatus), object position y(apparatus), object position z(apparatus)
rotate camera aax#, aay#, aaz#
move camera -200
cx2# = camera position x()
cy2# = camera position y()
cz2# = camera position z()
cx# = CURVEVALUE(cx2#, cx#, camspeed#)
cy# = CURVEVALUE(cy2#, cy#, camspeed#)
cz# = CURVEVALUE(cz2#, cz#, camspeed#)
cax2# = camera angle x()
cay2# = camera angle y()
caz2# = camera angle z()
cax# = CURVEANGLE(cax2#, cax#, camspeed#)
cay# = CURVEANGLE(cay2#, cay#, camspeed#)
caz# = CURVEANGLE(caz2#, caz#, camspeed#)
rotate camera cax#, cay#, caz#
position camera cx#, cy#, cz#
else
holdcamera = 0
endif
pos$ = "ox: "+str$(aax#)+", oy: "+str$(aay#)+", oz: "+str$(aaz#)
text 1,240,pos$
sync
until done
Thanks,
-JS