Download

Actor not replicating

Hey folks,

I’m trying to get the movement/position of a fairly simple Actor to replicate across server & client but am having some issues.

The Actor is derived from a C++ class and has two components: a collision sphere and a static mesh:

And I’ve set up the Blueprint so that replication ‘should’ be enabled:

4ab76bf6f85fd3158597b7b6a2699b7dc63fcc0c.png

Any ideas why when a player character (either client or server) moves the cube in-game that movement isn’t replicated across any of the connected clients? I just dragged and dropped an instance of the Blueprint in to the level I’m testing.

Thanks!

there is a checkbox (2 up from replicates) called replicate movement.

Tried that, but without any luck… forgot to re-check it when I recreated the Blueprint but it doesn’t make a difference.

So I’ve tried messing around with all of the replication check boxes (and adding UFUNCTION declarations to a few functions in the derived Actor class) and it looks like the Cube is now being partially replicated.

I say partially because the results are highly inaccurate…

CLIENT:

5c9dc089490220565a924fc027bc178a597b0d3f.jpeg

SERVER:

44f98400ceb8048be63ff76c26c074a8077ec412.jpeg

I really need the replication to be precise for this Actor - is there anything I can do to ensure it? All of the replication settings are on the Actor itself, I haven’t messed around with it’s components (the collision sphere and static mesh).

What you need is the client to request to the server to move the box and replicate the world transform results back to you and everyone else(SetWorldTransform)… or you need the box to give it’s transform to the server and multicast it to everyone else. This is what Run On Server and Multicast Events are for.

or, read these answerhub, similar issues

https://answers.unrealengine.com/questions/247199/replicating-meshes-affected-my-physics.html

https://answers.unrealengine.com/questions/101004/can-a-physics-handle-be-replicated.html

Apparently static mesh actors can be replicated by turning on Static Mesh Replication

"*In the 4.5 release you should be able to mark the static mesh actor for replication using Static Mesh Replication.

Let me know if you run into more issues.* "

Thanks!

I managed to get the replication working properly by deriving from AStaticMeshActor instead of AActor.

AStaticMeshActor seem to be a fairly simple class so I can probably duplicate it’s functionality reasonably easily (it’d be nice not to have the mesh as the root component so I can scale/move it etc).