• Post Reply Bookmark Topic Watch Topic
  • New Topic

Relative Mouse coordinates  RSS feed

 
Carlos Ramos
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone know how to get not the absolute mouse coordinates but its movement only.

The thing is... i am implementing a simple 3d aplication in java. I want to navigate in my 3d world with the mouse, just like you do when you play games like quake.

The problem is that with mouselisteners and mousemotionlisteners, if i move the mouse to the right i get it's coordinate but the mouse cursor moves to the right, and i can't ever do a 360 turn with the mouse caus the mouse get's to the end of the window... I don't know if i explained my problem correctly.. i hope so

thank you..
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by circuit circuit:
...i can't ever do a 360 turn with the mouse caus the mouse get's to the end of the window...

I've never done anything like this, but would it work to make your component edges "hotspots" for continued movement? In other words, as long as the cursor is within a certain distance of an edge, the background keeps "panning" in that direction?
 
Carlos Ramos
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that what you are saying is... if the mouse is for example closer to the right side of the "canvas" then it moves continously to the right. Yes that would work, but it wouldn't be has easy to use, and it would have the problem that to move forward you would need to put the mouse in the "exact" center of the screen so that there was no turn either to the right or left..

but it is a good idea...however i'm still trying to find another way to make the movement like a 1st person shooter.

I know that in c/c++ normaly people use direct input for these kind of problems... i don't know if java has some kind of API for that...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!