Download

Multiplayer Crouching jittering

I am trying to create first person multiplayer game, but I cannot figure out crouching. I read this thread [124174[/ATTACH]er-Questions-(Function-Variable-replication)"]Two Multiplayer Questions (Function + Variable replication) - Blueprint Visual Scripting - Unreal Engine Forums](Two Multiplayer Questions (Function + Variable replication) - Blueprint Visual Scripting - Unreal Engine Forums[ATTACH=CONFIG)
and came up with the solution shown in the picture below. This however causes problems when other client is looking at the player. The player is jittering up and down but from their own perspective it works as expected.

I am currently simply setting the collision capsule half height and apart from the jittering problem it seems to work.
I have two replicated events: one for serverside so that the player is able to walk under obstacles and second one for clientside so that the camera moves. Any help is appreciated!

Here is also a video of the problem:
[video]https://youtu.be/hbfGtB2qgr0[/video]

Don’t think your server side is firing on this setup.

Keypress -> (pass your references) call replicate to server -> call replicate to client -> your crouch logic.

Remember how things are described here. Currently you have client call both and the server side is only called (if server)

Thanks for the quick response. I tried this and server printed executed the print. 2a159e3a32a61efe99bda2ca1aec66565e8afd87.jpeg
Doesn’t that mean it is firing on server also?

Crouch and multiplayer usually works fine if you just use the builtin “Crouch”, “Uncrouch” and the already existing (and replicated) “IsCrouched” or “IsCrouching()” function of your character/character-movement component. You could even set the crouch height of the capsule there already. If you would recreate this yourself then you have to take care about tracing obstacles above your head as well. If you use the builtin crouch this is done for you already and works fine. For example if a client would uncrouch while he is below an obstacle it would remain crouched (even the variable remains crouched) until he moves to a place without obstacle above (where he uncrouches and the variables are set as well).

Also, if the “Set capsule half height” isn’t called on server, wouldn’t the player be unable to walk under obstacles?

I cannot get that working. Shouldn’t it work if I do this:

Never mind, I got it working by setting “Can Crouch” true in the character movements Nav Movement section. Only problem is that the crouching isn’t smooth since the camera is attached to the collision capsule and moves down when the capsule shrinks.

That’s what I thought. Since its part of the moment component.