Pixel-perfect panning for an orthographic camera on RMB, 2D, no character

s0up
Thu, 12 Mar 2026 05:46:58 +0000
Blueprint

I’m having trouble implementing pixel-perfect panning for an orthographic camera in a 2D game (no character). Basically, I need Google Maps style controls.

Also, I change the OrthoWidth for zoom using the mouse scroll wheel, so I need to account for that.

UE 5.7

I discovered that an OrthoWidth of 1080(camera settings) perfectly matches the mouse position with the scene while panning. So I get the current OrthoWidth and divide it by 1080(base value for perfect match) to scale the mouse movement. It works perfectly when the window width is ≥ 1080 in standalone mode. However, when I reduce the window width to something smaller than 1080, the panning starts to desynchronize. I suspect this might be related to my hardcoded OrthoWidth division or the DPI Scale curve (because 1080 is 1 there). I don’t want to disable DPI scaling ofc, and even if I do, it breaks again. What am I missing?

Here’s the main nodes:

3 posts - 2 participants