I have been working on a crouch function for a fps game, but i cant move the mesh inside of the capsule component so it looks smooth for both client and server. The crouch function makes the capsule size smaller each tick which results in the mesh feet sticking through the floor as the capsule gets smaller. To counter this the mesh needs to be moved equally in the opposite direction each tick, but the “SetRelativeLocation” function results in a very laggy motion of the mesh.
I believe this has something to do with network smoothing inside of character movement component, but cant figure out exactly how to counter it. Please help if you can.
I’d recommend just replicating a bool “IsCrouched” and then make the position changes in an on_rep function. That way you can make the movements client-side and not have to deal with network smoothing. I’d recommend using a timeline to handle the movements.
The crouching bool is set by the server in Begin and EndCrouch, the server then runs the function in the picture. The Crouching bool is then replicated to the other clients who will also call the function in BP.