How to: rotate camera with mouse on all axis

Blitz3D Forums/Blitz3D Programming/How to: rotate camera with mouse on all axis

Andres(Posted 2005) [#1]
Can any one help me to rotate a camera on all axis with mouse? I've tried to do this on my own, but everytime i've turned the camera on one axis the other one will be messed up :(

If you don't understand me then maybe you have played Freelancer? Turning the ship there is pretty much what i want.


Shifty Geezer(Posted 2005) [#2]
I use multiple pivots and only turn each one in one direction. eg.

Rostrum_Pan=createpivot()
Rostrum_Tilt=createpivot(Rostrum_pan)
Rostrum_Roll=createpivot(Rostrum_tilt)
camera=createcamera(Rostrum_Roll)

Then when you want to turn on X axis, use
TurnEntity rostrum_pan,xx,0,0

and for y
TurnEntity rostrum_tilt,0,xx,0

and for z
TurnEntity rostrum_roll,0,0,xx


Naughty Alien(Posted 2005) [#3]
;********************************************************************************
Function orbit_cam()
hor_rot=(hor_rot - (mxs*.5) ) ; get the mouse x and y speed,... adjust sensitivity by half
ver_rot=(ver_rot + (mys*.5) )
RotateEntity campiv_h,0,hor_rot,0 ; update the new camera pivot rotations
RotateEntity campiv_v,ver_rot,0,0
End Function


mxs and mys is mouseXspeed and mouseYspeed respectively


enjoy..


Storm8191(Posted 2005) [#4]
Andres: I haven't played freelancer before, but if what you're looking for is ideas for using the mouse for all three axis, maybe use the mouse wheel to affect rolling.


Andres(Posted 2005) [#5]
Thanks people!