1

So i've been bashing my head against this for a while. I'm using the DirectXTK11 with my own renderer and i'm using the Mouse class that comes with it. When the mouse is in relative mode, I take the mouse delta and multiply it by .05f to speed it up and then use it to rotate my camera. My issue is that when I'm rotating my camera diagonally, the movement is super jerky and never moves smoothly in the diagonal direction. It only moves to the left/right or up/down, especially if the mouse isn't moving very fast. I looked into the debugger and i'm seeing that even when the mouse is moving diagonally, if it's not moving very fast, either the X or Y value coming from the Raw Input is 0, despite the fact that the mouse is moving in both directions.

Here is a vide of the issue

I followed the DirectXTK tutorial on mouse movement but the rotation gain in that tutorial is too slow, hence why i'm multiplying it by a higher value. If there is more information needed, let me know. Thanks for your help!

jkinz3
  • 23
  • 6
  • The camera rotation gain value is essentially the unit angle velocity (in radians per frame or RPF) applied to the mouse delta to give the camera's rotation velocity. In your case, a value of 0.05 RPF seems exceedingly high. With a 60 fps frame rate, and at that angle velocity, the camera will possibly rotate through one or more complete revolutions, hence giving you the jerky motion. Instead try a rotation gain value in the neighbourhood of pi/1000 (~0.00314) which is over 10 times less than your current value. If this results in unusually slow camera rotation, I'd examine the mouse deltas. – Maico De Blasio Oct 26 '22 at 03:57
  • 1
    So I tried what you said and yeah the jerkiness is gone but now, i'm back to where I started. The mouse rotation isn't what I would call "unusually" slow. Its just too slow for my taste. I've figured out the issue. The problem is that the DirectX Mouse doesn't accumulate mouse moves. Mouse movement occurs multiple times per frame but only the most recent move event is counted when you get the mouse state. When the mouse is moving diagonally, X or Y could potentially be 0 for the event that actually gets retrieved. – jkinz3 Oct 26 '22 at 19:11
  • What frame-rate are you running the update loop (i.e. reading the mouse)? – Chuck Walbourn Nov 01 '22 at 06:39

0 Answers0