use mouse for first person game

I have programed one first person game using Java 3D and am working on a new idea and I hope to be able to run it through a web browser.

The problem I am having is using the mouse in the game were it does not leave the applet window when moved and I can keep track of how much movement it makes so I can make it function like a normal FPS (the mouse is moved in a certain direction and the character turns that direction the amount the mouse was moved). If someone could point me toward a class or of anyway this can be done that would be great. Thanks.

[566 byte] By [seegreena] at [2007-11-27 8:12:35]
# 1

Java does not have built-in support for direct polling of the mouse.

One hack that I've used to get around that is in the Robot class.

If the mouse exits the applet window from the left side, I can use Robot.moveMouse(int x, int y) to move the cursor back to the right side. This let's me force the mouse to be within the applet window at all times.

Its pretty hacky, and I believe you're going to have to get the user to sign some special permissions to use this in an applet, but there's not much alternative.

good luck

-Cuppo

CuppoJavaa at 2007-7-12 19:56:58 > top of Java-index,Other Topics,Java Game Development...
# 2
Thanks a lot. The robot class should work just fine. I may just put a option to use w a s d and the arrow keys or mouse polling. Thanks again.
seegreena at 2007-7-12 19:56:58 > top of Java-index,Other Topics,Java Game Development...
# 3
glad i helped. -Cuppo
CuppoJavaa at 2007-7-12 19:56:58 > top of Java-index,Other Topics,Java Game Development...