Hey. Cool code. I struggled forever to move the camera from side to side (strafe). Your code helped. Thanx
I adapted it to make camera controls using the middlemouse button and some combinations of keyboard keys, for a level editor I'm working on. Try it out
function doCam()
mmx = mousemovex()/5.0
mmy = mousemovey()/5.0
cx# = camera angle x(0)
cy# = camera angle y(0)
cz# = camera angle z(0)
if mouseclick() = 4
if (controlkey() = 0) and (shiftkey() = 0)
`middlemouse = pan camera
ROTATE CAMERA 0, cy#-90, 0
MOVE CAMERA mmx
ROTATE CAMERA cx#, cy#, cz#
ROTATE CAMERA cx#-90, 0, 0
MOVE CAMERA mmy
ROTATE CAMERA cx#, cy#, cz#
endif
if (controlkey() and shiftkey())
`control + shift + middlemouse = truck camera
move camera -(mmy)
endif
if (controlkey()=1 and shiftkey()=0)
`shift + middlemouse = look around
rotate camera cx#+mmy,cy#+mmx,0
endif
endif
endfunction
One problem remains. After orbiting the camera around a bit (specifically turning it about it's Y axis) The vertical pan starts going all screwy. What the Hell Is that?!
Can't figure it out
Anyone know why?