Mouse Wheel Camera

Blitz3D Forums/Blitz3D Programming/Mouse Wheel Camera

The Forum Archive is locked. These are the original blitzbasic.com forums, kept so their posts can still be read and searched. No new topics, replies or edits can be made here. To join the conversation, head over to the Blitz3D+ forums.

Joey you are still trying to reinvent the wheel here... Lets take your question backwards...

To place code on the forums you can either use {code} {/code} (the {} is really the [] but to make the example...) this is used for SHORT bits of code.

Long bits of code are used in {codebox} {/codebox} (again {} are really []...)

second... aside from remaking your code (I had to substitute a texture for one of my own) I find no problem in making it work... Push RIGHT mouse and turn and rotate WHEEL to move forward...??? What else do you want to do???
The WHEEL to move forward works IF you have pressed the RIGHT mouse previously... That can be fixed by cut and paste.
width = 1024 
height = 768 
Graphics3D width, height, 0, 1 
SetBuffer BackBuffer() 
Global dest_cam_x#,dest_cam_z#,dest_cam_pitch#,dest_cam_yaw# 

;Load Camera 
camera = CreateCamera() 
CameraRange Camera,1,5000 
PositionEntity Camera,0,1000,0 

gridtex = LoadTexture("grid.bmp") 
ScaleTexture gridtex,100,100 

;load Grid 
groundplane = CreatePlane() 
EntityTexture groundplane, gridtex 

While Not KeyHit(1) 

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 

Select MouseZSpeed() 
Case -1 
MoveEntity camera,0,0,-100 
Case 1 
MoveEntity camera,0,0,100 
End Select 

RenderWorld 
Flip 
Wend 
End 

All I get with your program is MEMORY ACCESS VIOLATION which means you made calls to folders or images that aren't there in my directory. Lets face it this is your first project isn't it! : )

Oh yeah... the French... Keeping in mind my French was HS French about 20+ years ago... "permission to move the object in Y using the mouse wheel"

You can also write it this way:
Graphics3D 1024,768,16,1
SetBuffer BackBuffer()

SetBuffer BackBuffer() 
Global dest_cam_x#,dest_cam_z#,dest_cam_pitch#,dest_cam_yaw# 

;Load Camera 
camera = CreateCamera() 
CameraRange Camera,1,5000 
PositionEntity Camera,0,1000,0 

gridtex = LoadTexture("grid.bmp") 
ScaleTexture gridtex,100,100 

;load Grid 
groundplane = CreatePlane() 
EntityTexture groundplane, gridtex 

While Not KeyHit(1) 

Select MouseZSpeed() 
Case -1 
MoveEntity camera,0,0,-100 
Case 1 
MoveEntity camera,0,0,100
End Select 

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 
; ############################################# Cleaning up the code slightly here
  mxs#=MouseXSpeed()/4
  mys#=MouseYSpeed()/4
  xa#=(xa#-mxs#)Mod 360
  ya#=(ya#+mys#)Mod 360
  MoveMouse GraphicsWidth()/2,GraphicsHeight()/2
  RotateEntity camera,ya#,xa#,0
EndIf

RenderWorld 
Flip 
Wend 
End 
: )
Now if you want it to move forward like it is walking on its own WHEN YOU PRESS the RIGHT mouse button that would be a simple modification.
-RZ