Mouse Wheel Camera

Blitz3D Forums/Blitz3D Programming/Mouse Wheel Camera

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Ok I am trying to make it so when I roll the mouse wheel forward it moves the camera forward and backward the camera goes backward. For some reason it dont work properly. First of all when the app loads and I try to move the camera nothing happens til after I have rotated the camera somewhere with the mouse (its set up to press and hold right click to pivot the mouse around). The second thing it does is if I roll the mouse wheel to go forward sometimes the camera starts going the wrong direction. Whats wrong with this. Here is the code I got.

mzs = mousezspeed()
if mzs = 1
moveentity camera,0,0,100
endif

Heres the code for the right mouse button deal.
if mousedown(2)
mxs=MouseXSpeed()
mys=MouseYSpeed()
dest_cam_yaw#=dest_cam_yaw#-mxs
dest_cam_pitch#=dest_cam_pitch#+mys
cam_yaw=cam_yaw+((dest_cam_yaw-cam_yaw)/5)
cam_pitch=cam_pitch+((dest_cam_pitch-cam_pitch)/5)
RotateEntity camera,cam_pitch#,cam_yaw#,0
MoveMouse Width/2,Height/2
endif