Attach a Character to Another Character's Socket

Hello,
I am trying to attach a player Character to another player’s Character in a networked game. I’m running into a lot of issues with what I assume to be the attached player’s movement component having trouble reconciling movement with the attach parent player’s movement.

The attached player appears to move smoothly, but the parent becomes very jittery and jumps around while trying to move, and the attached player and parent player seem to not be totally in sync (as one rotates the other doesn’t seem to match the rotation 1:1 only doing a roughly 3/4 turn for every full turn of the parent).

I’m wondering if there’s a way to completely stop my client player from controlling its position so he can just be stuck to the bone he’s attached to, or if there are any other ideas about why this might be happening.

It seems like it should be functionality that exists, because there are a lot of scenarios where a local owning player may no longer be in control of their position (passenger in vehicle, being carried by another player, etc.), but it’s totally messing up for me. I feel like I must be doing something wrong. Any input at all would be great.

Update edit:

So I’ve tried something new that also doesn’t work. I’m unpossessing the attached player and making him a spectator stuck to the now attached pawn. It is still having huge replication/prediction issues. I was able to add some debug data to show that it’s the attached pawn that appears to be stuttering, not the parent.

I’ve tried doing a similar test with a non-possessed version of my character pawn, and it works as expected on both the client and the server (stays attached to the socket rather than jumping around).

I feel like there must be something I’m missing. What else would be different between a formerly possessed pawn and a pawn that’s never been possessed, and is there a way to make my formerly possessed pawn revert back to that state?

Update 2:

So I’ve been looking more. Tried tearing down the Unpossess function and removing bits line by line. It seems like setting the Controller to NULL seems to make it work leaps and bounds better, but I’d like to avoid removing the controller completely if possible (A lot of functionality of the controller is still desired, just not character movement).

What else can I try here?

I’ve been investigating, and even unpossessing and removing the movement component seem to not remove the jitter on the parent character, so now I have no idea what to think anymore.

Are there just issues with attaching a character to another character in general with or without movement components or having player controllers?

I don’t have any issues attaching non-character actors to the same socket.

More investigation. I tried placing one of my character blueprints in the level without having it controlled by a player, and it seems to be working as intended, so I believe it’s something to do with possessed players being attached to other players over the network.

Ok. So I think I figured out what my problem was finally. I wasn’t changing the character’s movement mode when he was being carried. Making sure to set the movement mode to None seems to have fixed the problem I was having. I think I just never realized that that movement mode essentially does what I wanted it to, which is to ignore network updates. It seems to work almost perfect with that change.

2 Likes