Mouse location doesn't update every tick

First of all, this issue does NOT happen in 5.6 or 5.7, but does in all prior engine versions that I’ve tested. I’d prefer not to upgrade to 5.6+, so I’m hoping I can work around this.

When retrieving the mouse’s location every tick in Blueprint, the location returned is often an old value from the previous tick. While the mouse is continuously moving, the same location is frequently reported 2 or 3 ticks in a row. I’ve tried getting the location with a variety of nodes (GetMousePosition, ConvertMouseLocationToWorld, and GetInputMouseDelta) and they all have the same issue. It’s most easily observed when using GetInputMouseDelta, because the delta returned will often be 0,0 while the mouse is actively moving.

Something to note is it mostly seems to happen if performance is CPU limited. If performance is GPU limited, or if the FPS is artificially capped (via the t.maxfps console command), the mouse location is up to date and accurate every tick.

For context: What I’m working on is a top-down camera system that allows the player to click and drag on the world to pan the camera around. While dragging, I’m getting the mouse’s delta each tick, and moving the camera a distance to match how far the mouse has moved since the last tick. It works, but because mouse location updates are frequently skipped, it’s causing the camera movement to be very stuttery, as if the game is running at a lower framerate than it really is. It’s so bad that when the game is running at ~140fps, the camera dragging feels more like it’s running at ~40fps.

Anyone know why this is happening? Any ideas for a workaround?

Most people use some arbitrary float to multiply with delta seconds in order to make values frame rate independent. You could try that. The below is about physics, but the principle is the same.

How to use Sub-Stepping to smooth out your Physics - #ue5 #unrealengine #JustBalls #devlog 23