Crouching / Uncrouching Issue in Multiplayer with Latency (True FPS)

So, I’m doing a basic crouch / uncrouching, nothing special, literally just on input I send crouch & when released I send Uncrouch.

My camera is attached to my head bone because I’m doing a true first person with spine bending so this is non-negotiable.

My AnimBP reads “bIsCrouching” from the CMC and then moves the player locomotion state from Idle to Crouching State / blendspace.

r/UnrealEngine5 - Crouching / Uncrouching Issue in Multiplayer with Latency (True FPS)|750xauto

r/UnrealEngine5 - Crouching / Uncrouching Issue in Multiplayer with Latency (True FPS)|347xauto

r/UnrealEngine5 - Crouching / Uncrouching Issue in Multiplayer with Latency (True FPS)|405xauto

r/UnrealEngine5 - Crouching / Uncrouching Issue in Multiplayer with Latency (True FPS)|380xauto

The issue I have is:
When I crouch → Uncrouch quickly / instantly, there’s a “up” then “down” “correction” at the end. but ONLY when I have latency. If latency is 0 this DOES NOT happen.

If I Crouch → Wait 1-2 seconds → Uncrouch no issues arise.

Latency also affects how long I must stay crouched for so this doesn’t happen, so if I simulate 1000 latency I would need to stay crouched for multiple seconds to avoid this from happening.

Video example of the issue:

https://medal.tv/games/screen-capture/clips/lYhnVCnxuaGeV8MvE

I did some tests with OnStartCrouch and OnEndCrouch:

r/UnrealEngine5 - Crouching / Uncrouching Issue in Multiplayer with Latency (True FPS)|588xauto

And this is what it returned ingame:

r/UnrealEngine5 - Crouching / Uncrouching Issue in Multiplayer with Latency (True FPS)|98xauto

As you can see, when I send the input to crouch / uncrouch fast, BOTH happen locally first (as expected of course since it’s locally predicted). The issue is that when the server begins its own process it seems to be causing the animation state to correct the location of the camera.

If I hold down crouch long enough then server also begins the crouching which prevents corrections from happening.

Any ideas on how to fix this issue?

Hey @SteelJardas how are you?

Your analisys is actually very accurate! This is a replication timing issue that only becomes obvious because the camera is attached to the head bone (true first person), so any correction is very noticeable.

Crouch in CharacterMovement is server-authoritative but client-predicted. With latency, when you crouch and uncrouch very quickly, the client goes into crouch and back out locally before the server has even started its own crouch. When the server processes crouch and replicates that state back, the client receives a late authoritative update and corrects capsule height, mesh offset, and animation state. Since the camera follows the head bone, this correction shows up as a visible up/down snap.

A possible fix is to avoid uncrouching until the server has actually confirmed that the character is crouched at least once.

You can do it with something like this:

On crouch pressed:

  • Call Crouch locally (prediction is fine)
  • Set a local bool like bServerConfirmedCrouch = false

When bIsCrouched becomes true from replication (OnRep or via the CMC in the AnimBP):

  • Set bServerConfirmedCrouch = true

On crouch released:

  • If bServerConfirmedCrouch is false, do nothing yet
  • If bServerConfirmedCrouch is true, call UnCrouch

This keeps the client and server crouch state in sync and prevents the server from applying a late crouch after the client has already uncrouched, which is what causes the camera correction.

Please let me know if this worked for you or if you need more help!!