Depending on your situation, a solution would be to not move the viewport/window at all, but move everything else on the layout relative to the player instead.
My project is too big to make a thing like this ^^' but anyway I just wanted to make this for fun.