• Post Reply Bookmark Topic Watch Topic
  • New Topic

Mouse look  RSS feed

 
Nick George
Ranch Hand
Posts: 815
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm working on a 3D first-person fullscreen environment which uses the mouse to look around. My problem is that it doesn't take long for the mouse to hit the edge of the screen, after which it's impossible to look any further. I could just make the mouse super sensetive, but I'd much rather have some control over the mouse. I'd like to constantly have the mouse be repositioned at center. I realize this is sort of out of the non-intrusion we like so much in java, so if anyone sees any alternative, I'm all ears.
 
Jeff Grant
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here you go.. just have your thread call this set of code every once in a while to reposition the mouse pointer on the screen to give more scrolling area.

However, unless you are basing your environment movements of your 3D app by position on the screen, it shouldn't matter if it hits the side of the screen... right is still right, left is still left, regardless if the mouse cursor itself is moving, I would think..
 
Steven Bell
Ranch Hand
Posts: 1071
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeffs solution should work, and I think it is fairly common in 3D first person apps. The problem is that when the mouse hits the edge of the screen it no longer moves past that position so movement events in that direction are not longer fired. You could test it by using a MouseListener that just does a s.o.println() for each movement.
 
Nick George
Ranch Hand
Posts: 815
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Jeff.
 
Jeff Grant
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Steven Bell:
Jeffs solution should work, and I think it is fairly common in 3D first person apps. The problem is that when the mouse hits the edge of the screen it no longer moves past that position so movement events in that direction are not longer fired. You could test it by using a MouseListener that just does a s.o.println() for each movement.

Thanks for the added information Steven. I've never used the mouse motion listener where it needed to go off the screen. I should have thought it through more before posting my thoughts past the question!

Glad I could help Nick.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!