fivem icon indicating copy to clipboard operation
fivem copied to clipboard

Camera moving uncontrollably when using remote/streaming clients (Moonlight/Sunshine or Steam Link)

Open psychedel1que opened this issue 7 months ago • 12 comments

What happened?

If you're trying to play FiveM through any remote/streaming client, be it Moonlight/Sunlight, be it Steam Link, the mouse cursor will be uncontrollably moving in the top left corner of the screen. Either way, for whatever reason, you are able to move the mouse in order to connect to a server, but stopping will teleport the cursor back to the top left.

If you manage to get into a server, any mouse movement will uncontrollably move the camera.

https://youtu.be/QOSYPv64ihA?feature=shared

In the video above, you can observe at first that moving my host PC's mouse will work without any problems, but any mouse movement on the remote PC will instantly uncontrollably move the camera. Clicking works (the punch), it's just the mouse movements that are bugged.

Expected result

The mouse movements should work on remote/streaming clients, but it doesn't, making the camera move uncontrollably

Reproduction steps

  1. Install any remote PC/streaming client, be it Moonlight with Sunlight or launch FiveM through Steam Link.
  2. Launch FiveM from the remote client.
  3. Observe the mouse cursor being stuck/spazzing out in the top left corner of the screen.
  4. Join a server.
  5. Move the mouse while observing an uncontrollably moving camera.

Importancy

Unknown

Area(s)

FiveM

Specific version(s)

FiveM Canary, build 15156 or b3258

Additional information

I suppose this happens on any kind of remote PCs like Parsec, ShadowPC, or any other "cloud gaming" services.

Nvidia Shadowplay is disabled by default (recording or Instant Replay doesn't work). I thought it might fix the problem if I enable Shadowplay, but it didn't. Recording/Instant Replay works but FiveM still has the issue presented above.

Issue is related to this one from RedM: https://github.com/citizenfx/fivem/issues/2578

psychedel1que avatar May 21 '25 15:05 psychedel1que

image Hello do you know how to slove this problem

Abosefo12 avatar May 21 '25 15:05 Abosefo12

Tested again today with latest pre-release version of Sunshine (v2025.611.5625), and it's working flawlessly. Don't know if it's fixed on your side or on their side, but for now it's fixed. Will continue testing and will keep you updated in this thread in case of anything.

Thank you!

psychedel1que avatar Jun 11 '25 19:06 psychedel1que

hi, I've been having the same issue but I switched to the latest pre-release (which seems to be 2025.615.24501 at the time of writing) and it still doesn't work. did you only update sunshine or did you do other things as well?

jwillb avatar Jun 21 '25 05:06 jwillb

found the actual workaround that helped me, didn't know until now when i tried again.

install Parsec and either use that, or go back to using Moonlight/Sunshine, but keep parsec installed and (i think) also opened. it seems it works without any problems IF parsec is installed. no idea why and how, doesn't really make any sense to me, but it seems that's the workaround.

psychedel1que avatar Jun 25 '25 09:06 psychedel1que

I found a fix as well, though the game is limited to 60Hz. In the game itself I changed it from fullscreen mode to fullscreen (exclusive) mode and then it seems to work fine.

jwillb avatar Jun 25 '25 15:06 jwillb

Can confirm. Changing from Fullscreen to Fullscreen (Exclusive) (AKA Windowed borderless) fixed this issue. No parsec or any other third-party software needed. This doesn't happens on vainilla GTA V, so there's totally an issue with FiveM itself.

My environment:

Server (the PC running FiveM):

  • Windows 11 x64
  • 32GB RAM
  • RTX 3080
  • Single screen (1280x720)
  • Sunshine, GTA V, OS and FiveM up to date using stable branches (the GPU has an older driver because of compatibility concerns)

Client (The PC running Moonlight)

  • SteamDeck
  • Using Gamemode
  • No mouse, mousepad, keyboard or external gamepad connected (just using the attached gamepad)
  • Streaming in 1280x800 (native resolution for the SteamDeck)
  • Touchscreen is not being touched
  • The mouse works fine once closing FiveM. Also works if streaming GTA V even at the same session (using Desktop Mode from Moonlight)
  • Moonlight and SteamOS Is up to date using stable branches

JPZV avatar Jul 02 '25 04:07 JPZV

The cause of the problem seems to be the same as this: https://github.com/citizenfx/fivem/issues/2726

As you can see, this is an issue that hasn't been addressed in over a year

Kerato-san avatar Sep 07 '25 20:09 Kerato-san

Can confirm. Changing from Fullscreen to Fullscreen (Exclusive) (AKA Windowed borderless) fixed this issue. No parsec or any other third-party software needed. This doesn't happens on vainilla GTA V, so there's totally an issue with FiveM itself.

My environment:

Server (the PC running FiveM):

  • Windows 11 x64
  • 32GB RAM
  • RTX 3080
  • Single screen (1280x720)
  • Sunshine, GTA V, OS and FiveM up to date using stable branches (the GPU has an older driver because of compatibility concerns)

Client (The PC running Moonlight)

  • SteamDeck
  • Using Gamemode
  • No mouse, mousepad, keyboard or external gamepad connected (just using the attached gamepad)
  • Streaming in 1280x800 (native resolution for the SteamDeck)
  • Touchscreen is not being touched
  • The mouse works fine once closing FiveM. Also works if streaming GTA V even at the same session (using Desktop Mode from Moonlight)
  • Moonlight and SteamOS Is up to date using stable branches

Hey @JPZV can you detail how you changed from Fullscreen to Fullscreen (Exclusive) (AKA Windowed borderless)? I don't see options for this in fivem itself? I've tried passing the param -windowed to fivem.exe and this doesn't fix it for me. Was this done in moonlight, in GTA5 game settings or somewhere in fivem, or maybe an additional parameter to fivem?

gentoorax avatar Sep 09 '25 05:09 gentoorax

Hey @JPZV can you detail how you changed from Fullscreen to Fullscreen (Exclusive) (AKA Windowed borderless)? I don't see options for this in fivem itself? I've tried passing the param -windowed to fivem.exe and this doesn't fix it for me. Was this done in moonlight, in GTA5 game settings or somewhere in fivem, or maybe an additional parameter to fivem?

You won't see the Fullscreen (Exclusive) option unless you switched to fullscreen first, then exited the settings, once you go back into the game settings then you'll see the option for Exclusive

S4CKY585 avatar Sep 09 '25 08:09 S4CKY585

Doesn't fix it for me. It happens with all screen format types. Even when I set it to windowed smaller than the screen, it bounces to the top left of the primary screen (not the window) when fivem/gta is not in focus instead. If in focus, it flickers to the top left of the gta/fivem window. I'm pretty sure this is dependent on how FiveM captures the mouse. Inputs that set the mouse position instead of giving translation glitch out the system.

Kerato-san avatar Sep 09 '25 15:09 Kerato-san

So this has been an issue since May last year. I'm frustrated with waiting. So I looked at commits with cursors around that time. The only one I can find is Commit 7007fc1. It has to do with cursor clipping code/components/rage-input-five/src/InputHook.cpp I do not see any other files changed how they handled cursor things around that time.

My theory now is that it has to do with how the clipping handles absolute cursor input device data instead of delta cursor input device data. It could be wrong, but maybe this lead will give someone who can fix it the motivation to have a look.

Kerato-san avatar Sep 09 '25 19:09 Kerato-san

You can get past it if you don't connect until the game is loaded, the launcher seems to be the big issue. YMMV

Draythianna avatar Oct 31 '25 02:10 Draythianna