Mouse resolution

Started by Qudus, February 03, 2008, 16:15:58

Previous topic - Next topic

Qudus

hi

Is there a way to increase the mouse resolution in LWJGL? It seems that the resolution is always equal to the window's resolution even if the mouse is grabbed. This leads to "snappy" camera for e.g. first-person cameras for lower resolutions.

Thanks.

Marvin

Matthias


wolf_m

I'm getting the delta for the x and y coordinates every frame (Mouse.getDX() and Mouse.getDY() and similar). If you do that as well, you can divide through some divisor and move the camera / pointer sprite / whatever accordingly. If you're asking for the absolute coordinates, you can't really do it like that because the absolute coordinates are absolute :) Is that what you're asking?
If you're talking about mouse acceleration, that's not the job of lwjgl; that's part of the hardware driver implementation. You should have some application shipped with your OS that lets you adjust this in your Window Manager of choice.

Qudus

Quote from: wolf_m on February 03, 2008, 19:02:48
I'm getting the delta for the x and y coordinates every frame (Mouse.getDX() and Mouse.getDY() and similar). If you do that as well, you can divide through some divisor and move the camera / pointer sprite / whatever accordingly. If you're asking for the absolute coordinates, you can't really do it like that because the absolute coordinates are absolute :) Is that what you're asking?
If you're talking about mouse acceleration, that's not the job of lwjgl; that's part of the hardware driver implementation. You should have some application shipped with your OS that lets you adjust this in your Window Manager of choice.

No. I'm not talking about mouse acceleration. And of course for an absolute mouse (not grabbed) the x/y values should be related to the window's resolution. And at least for me it is totally fine as it is for an absolute mouse.

I am specifically talking about the delta values (getDX() and getDY()). The problem is not too bad, if you're moving fast. Consider you're in an FPS shooter and want to turn around. You would use a relative mouse (grabbed in LWJGL) and would adjust the angle when dx or dy are not zero. If you turn around fast, you won't recognize any "snapping". But if you move the mouse very slowly like pushing it micrometer by micrometer until dy or dy return the next non-zero value, the camera rotation will snap to the next discrete angle. You will notice this, if you're carefully looking around in your scene.

Even if the angle is a float value, it is adjusted in discrete steps, since the mouse delta values are int values.

This snapping can only be avoided through a higher mouse resolution, which would have to be independent of the Display's resolution.

I hope, this explains the issue a little clearer.

Marvin

wolf_m

There is nothing but discrete steps for a digital computer.

If you want to increase precision and still have fast turning, increase the divisor until you're satisfied with the precision and implement your own extra acceleration for the fast-turning feature. You could for example decrease the divisor with growing deltas in a natural-feeling way. And I suggest separate divisors for x and y.

No matter how high your mouse resolution is, someone who plays in your engine will have a shitty mouse and thus a bad experience with your game, so you have to add some adjustment options, meaning said maximal divisor and a parametrized acceleration function.

darkprophet

Implement a spring with X tension between the cursor and the POV. The greater the tension, the closer the POV will be to the real location.

Call this "mouse smoothness" in your options area.

DP :)

Qudus

Thanks, wolf_m, this realy sounds like a solution, that might work.

Marvin