I am working on a multiplayer game at the moment, I have managed to get most animations and actions to replicate pretty well. The problem is that other players will appear to sink and float when crouching. It does not happen when moving, only stationary.
This only appears to other clients, the player in question will see no problem in their location
Thanks for the speedy response, the capsule shrinks to a ball, and stays like that even when walking. I am using the engines built in “is crouching” as apart of the movement component
Right. And you had to position your mesh relative to the capsule. So when the capsule height changes, the mesh is no longer in the correct relative location. When you crouch, you need to set the mesh location so it doesn’t fall through the floor as the capsule center gets lower.
Usually you want to get the capsule’s scaled half height, negate it, and apply it to the Z axis of the relative location of the mesh.
Oh right. The owning client tells the server to crouch so they both work. It seems the other clients do not get in on the event so they can do whatever the owning client does to adjust the mesh location. It’s hard to say without seeing the relevant code. But you may need to either use a multicast RPC or a RepNotify to tell the other clients that they need to call the crouch code too.
This is still ruining my life. Sorry I let the thread die, I thought i would manage to fix the replication down the line. I was wrong. I am losing sleep. The crouch replicates on the server. Crouch maintains base location. I do not know what is wrong
I still don’t have enough information to help you any more than I have. Can you share the project or provide an example project with the issue?
Another option is to take a look at [this][1] project. It provides a character capsule with its origin at ground-level. That way you don’t need to reposition the mesh when you crouch/stand. I’m using it in my main project and it has worked really well with players and AI (but I can’t guarantee it handles everything, it’s just doing as much as I need it to). You should be able to get the classes into your own project. Note: this will require adding C++ to your project – if you haven’t already. Oh, and it’s working with 4.18.3. It should work with more than that but I can’t say because I haven’t tried.
Thank you so much for your generous help, I fixed it by allowing the skeletal mesh and its parent replicate on a server. I am an idiot. Didn’t think this would be a problem since it already kind of does replicate. Cleaning up my BP now.
I’ve never used Crouch and Uncrouch. I always handled it myself. I can see that Crouch and Uncrouch handle replication for you. You only need to call them on the owning client. You don’t need server or multicast RPC.
What you want to do is adjust the location of the character mesh. There are events OnStartCrouch and OnEndCrouch. When those trigger, you want to change the location of your character mesh relative to the center of the capsule. Use SetRelativeLocation with the right Z location and they will all show the right heights at the right times.