x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Player Floats and Sinks when Crouching in multiplayer

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

Bellow I have attached a gif of my problem

alt text

Product Version: UE 4.18
Tags:
ue4problem.gif (3.8 MB)
more ▼

asked Feb 11 '18 at 03:25 PM in Blueprint Scripting

avatar image

Miles4299
6 1 2

avatar image Miles4299 Mar 11 '18 at 11:38 PM

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

alt text

kilme.gif (4.7 MB)
avatar image Miles4299 Mar 11 '18 at 11:44 PM

It works on a ?listen server, only for the server player. Something is not replicating with the crouch function, or un crouch function. Help me please

alt text

kilme2.gif (4.0 MB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

Make the capsule visible and not hidden-in-game and if it doesn't help you see the problem post a GIF of that for us to see.

more ▼

answered Feb 11 '18 at 08:32 PM

avatar image

Jin_VE
4.4k 32 79 42

avatar image Miles4299 Feb 11 '18 at 11:39 PM

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 componentalt text

porblem2.gif (2.5 MB)
avatar image Jin_VE Feb 11 '18 at 11:52 PM

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.

avatar image Miles4299 Feb 11 '18 at 11:55 PM

Additionally, here you can see the client is normal. but not for the other clientalt text

ue4probx.jpg (130.9 kB)
avatar image Jin_VE Feb 12 '18 at 01:13 AM

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.

avatar image Jin_VE Mar 12 '18 at 12:01 AM

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 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.

avatar image Miles4299 Mar 12 '18 at 06:01 PM

alt text

Its a mess right now but this is the crouch command, I know it probably shouldnt look like this but this is the best i could get it working.

https://answers.unrealengine.com/questions/385774/character-mesh-offset-after-calling-crouchuncrouch.html

i noticed this guy had the same problem, and it was related to an engine problem.

bodge.jpg (76.9 kB)
avatar image Jin_VE Mar 12 '18 at 10:08 PM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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.

more ▼

answered Mar 12 '18 at 06:31 PM

avatar image

Miles4299
6 1 2

avatar image Jin_VE Mar 12 '18 at 10:07 PM

That's weird. No one does it that way so I'm surprised it worked. Check out the comment I am leaving above. You don't need all that RPC.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
 if(Crouched)
 {
     Capsule->SetCapsuleHalfHeight(CrouchedHalfHeight);
     Mesh->SetRelativeLocation(CrouchedHeightAdjustVector);
     OwnerActor->UpdateComponentTransforms();
 }
 else
 {
     Capsule->SetCapsuleHalfHeight(HalfHeight);
     Mesh->SetRelativeLocation(HalfHeightAdjustVector);
     OwnerActor->UpdateComponentTransforms();
 }
more ▼

answered Jul 29 '18 at 02:35 PM

avatar image

HaJH
1 2

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question