Unrestricted look mode

Blitz3D Forums/Blitz3D Beginners Area/Unrestricted look mode

fox95871(Posted 2008) [#1]
http://h1.ripway.com/fox95871/index.html

Hi, could someone please show me how to make this so the camera doesn't stop when the mouse gets to the edge of the screen? To explain better, in games where you look around with the mouse, you can turn 360 degrees over and over while still holding down the mouse button for the first time, you just pick up the mouse itself and move it over so you can continue dragging. But right now my engine only lets you turn until the pointer gets to the edge of the screen. To turn more, you have to let go of the mouse button, move the pointer over, then click and drag again to continue turning. In other words you usually run out of screen before you run out of mousepad. I've tried some things to fix it, like If mouseposition=1 mouseposition=639, and If mouseposition=640 mouseposition=2, but nothing's worked so far. Any help from users more experienced in this kind of thing would be very much appreciated.


KillerX(Posted 2008) [#2]
MoveMouse Graphicswidth()/2,GraphicsHeight()/2


GIB3D(Posted 2008) [#3]
MoveMouse GraphicsWidth()*.5,GraphicsHeight()*.5

I usually use multiplication so in the rare impossible case that GraphicsWidth or GraphicsHeight does equal 0, you won't get an error.

If you divide any number by 0, even on calculators, you get an error.


Stevie G(Posted 2008) [#4]

I usually use multiplication so in the rare impossible case that GraphicsWidth or GraphicsHeight does equal 0, you won't get an error.



That's irrelevant in this case as 0/2 = 0.


fox95871(Posted 2008) [#5]
This is in response to the first reply only, that's all there was yesterday. I'll try the other 2 tonight.

My camera's turn variable is determined by the mouse's position on the screen, so centering the mouse just makes the camera jump back. I think I need some way to simulate the mouse traveling off screen so I can get it's variable there. Any ideas? I can picture it, but it's too early for me to know how to approach something like that. If anyone knows a way, please feel free to amend my code and post it. That would really help me.


Nate the Great(Posted 2008) [#6]
use mousexspeed and mouseyspeed


KillerX(Posted 2008) [#7]
Look at this code:
http://www.blitzbasic.com/Community/posts.php?topic=78895#885710

Repeat
Xturn = Graphicswidth()/2 - MouseX()
Yturn = GraphicsHeight()/2 - MouseY()
;Other code goes here
Xangle = Xangle + Xturn
Yangle = Yangle + Yturn
Forever

This should work.


fox95871(Posted 2008) [#8]
http://h1.ripway.com/fox95871/index.html

I couldn't get it to work, but I decided on something I think I like a lot better anyway. The above link is the new code. Hope someone finds it useful.