microsoft / DirectXTK

The DirectX Tool Kit (aka DirectXTK) is a collection of helper classes for writing DirectX 11.x code in C++

Home Page:https://walbourn.github.io/directxtk/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mouse has jerky movement at higher sensitivities

jkinz3 opened this issue · comments

Using the mouse state deltas directly works but is slow. If you scale the deltas up, diagonal movement is jerky. It seems like this is a result of the deltas being stored as integers. Is this intentional? If it is, how can I make mouse movement smoother?

diag_2

This is for the projects here and here rather than the DirectX Tool Kit itself...

Looking at the code, part of the problem is I think I used elapsedTime too many times:

            Vector3 delta;
            if (kb.LeftShift || kb.RightShift)
            {
                delta = Vector3(0.f, 0.f, -float(mouse.y) * handed) * m_distance * elapsedTime;
            }
            else
            {
                delta = Vector3(-float(mouse.x), float(mouse.y), 0.f) * m_distance * elapsedTime;
            }
...
    m_cameraFocus += delta * elapsedTime;

Apologies for submitting this on the wrong project. I wasn't paying enough attention.
However, the reason I used the model viewer project in the gif was to show that it wasn't a problem specific to my project. This occurs in my project as well.
Thank you for responding so quickly! I really appreciate it