mouse control screen?

Blitz3D Forums/Blitz3D Beginners Area/mouse control screen?

Braden(Posted 2008) [#1]
how do you make it so where the mouse goes, the camera turns that way? Could someone give code that would do that?

thanks!


Mortiis(Posted 2008) [#2]
Could you please use the forum search function and the Code Archives before you ask something?


Zeotrope(Posted 2008) [#3]
Also, check out the sample code that comes with B3D. The basic stuff is covered.


Braden(Posted 2008) [#4]
ok, thanks


fox95871(Posted 2008) [#5]
http://blitzbasic.com/Community/posts.php?topic=80923

The last post here has a download that might help, though it's more for editing levels than looking around. But it is a mouse controlled camera.


Braden(Posted 2008) [#6]
ok, I looked through the samples and I couldn't find the code... could anyone give me the code?


stayne(Posted 2008) [#7]
The code archives are full of mouselook examples...you're just not looking hard enough. It seems to me from the amount of posts you have made and how you ask questions you are relying on others to supply you with code. Work harder Braden and it will pay off.


Braden(Posted 2008) [#8]
ok


Pongo(Posted 2008) [#9]
Check the answer I posted in one of your other threads. It leads you to a good tutorial that should help with some of these basics.

http://www.blitzbasic.com/Community/posts.php?topic=81576


Braden(Posted 2008) [#10]
thanks


Braden(Posted 2008) [#11]
I checked out the tutorial and it worked, but, when I move the mouse, I can't figure out how to make it turn left and right, I was editing and testing the code to try and find an answer, but I couldn't figure it out...

My question is, how do I make the mouse turn the screen left and right?

here is the code I got from the tutorial...

TurnEntity camsphere2, 0, -MouseXSpeed()/5.0, 0			;rotate player Pivot according to mouse X movement
TurnEntity camera2, MouseYSpeed()/5.0, 0, 0			;rotate camera up/down according to mouse Y movement
If EntityPitch(camera2) < -45					;don't allow camera to look below -45 degrees
  RotateEntity camera2, -45, EntityYaw(camera2), EntityRoll(camera2)
EndIf 
If EntityPitch(camera2) > 45					;don't allow camera to look above 45 degrees
  RotateEntity camera2, 45, EntityYaw(camera2), EntityRoll(camera2)
EndIf
MoveMouse GraphicsWidth()/1.3, GraphicsHeight()/2.1		;reset mouse position to middle of screen


thanks


Pongo(Posted 2008) [#12]
Looking at the code you posted above, you are turning "camsphere2" on the first line of code, and "camera2" on all of the others.

The actual code looks like it should work.


Braden(Posted 2008) [#13]
I ahd to switch camsphere2 with camera 2, it worked! thanks!