Adjustments to Relative Location of Character Mesh Fails to Network Properly at Runtime

I want to update the relative location of a Character’s mesh component, but I also need to do this through the network.

The condition for triggering this location change is based on a replicated data member. At runtime, a player does an action that modifies the replicated data member, if the player is not the server, it makes sure to call the needed server method so the server can set the value and trigger the replication for all clients.

When trying to do this for shrinking the character size - the mesh scale gets replicated perfectly, but the mesh’s relative location does not. It replicates and sets the values, this I’ve confirmed, but every tick after that is setting the location back to it’s default, starting values. Even if I manually force the repositioning every tick, it get’s ignored.

What’s even stranger is that the player controller that causes the shrinking does so perfectly fine on their own client, but every other client resets their position on their end.

When I do this in BeginPlay():
GetCharacterMovement()->NetworkSmoothingMode = ENetworkSmoothingMode::Disabled;

It’s seems to function better - the bug happens, but only if standing still, and only from server to clients or clients to clients.

In essence, when I do this with the proper replication framework:
GetMesh()->SetRelativeScale3D(newMeshScale);
GetMesh()->SetRelativeLocation(newMeshLocation);

The scale works fine; the relative location changes for all, but resets for each client that doesn’t own it.

Also not sure why disabling the smoothing mode helped fix parts of the bug.

Does anybody know why this happens and any good work arounds or solutions?

The image below show the Z value returning to it’s default value of -90.0. The red line is the server.
image

This image also shows how the owning player keeps the new position, but all others reset to the default location:
image

Ah, just found this forum post from 2015 - it’s apparently a known bug with the Character class and it’s network smoothing mode. The forum has some work arounds mentioned, so if you come across this issue in the future, here you go:

1 Like