PhysicsHandle Does Not Replicate to Client

Hello,

i have some problem with my replication. So i made blueprints to pick up a physics simulating object, and hold it just in front of a character. This works finde for the Player who is the Server. The clients can see him running around with the object. But if a client took it up, just the client see this, the Server Player and the other clients don’t see this and the object is still on the same place.

Here is my Character BP:

And these are the parts of the PlayerController that contains the blueprints handle the grab:

I hope someone can help me. The Objects have replication activated, also movement replication. I think its something with the replication of the phiysics handling.

The grabObject Event should be done via rpc. So you need a serverGrab which calls a multicastRPCGrab which does the logic. Call the serverGrab by the Client on mouseClick

First of all thank you for the quick awnser. I tried to do it like you told me:

Because the client can grab the object i think this works fine. I think there is a problem with the position of the physicshandle and the communication of the physicshandle position to the server. I’m also not sure if its possible to use it the way i use it. Actually The server player can use the objects, run arround with them, the client can do this also but the others can’t see it and the object is still at the same position for the server and the other clients.

First of all thanks for the quick awnser, i tried to do like you wrote it, but i still have the same problem, everything works fine for the server but not for the clients. Maybe its something with replication of the Position of the object if a client holds it.

Here are the corrected BPs:

The client can pic it up and move it around, so i think the pick up works, its just that the position of the object on the server and the other clients doesn’t change, maybe you or someone else has an idea?

no, that in your tick is not good. don’t do rpcs in tick. think about it, your tick runs like 100 times a second, do you really want to call your code on lets say 10 clients - and all reliable on top? What do you expect the server to do other than handling network :wink:
Look at the code, every variable which replicates - you want to set only on the server (hasAuthority switch). have you set your actors to replicate? you can set it on attaching the physics handle, and disable replicating when detaching. The updatePosition logic could run on tick, but not via RPC (a regular event) - because any of your clients (incl. server) runs a copy of that actor and it’s Tick and simulates that updatePosition.

But one node - physics simulations and network - always sucks :wink: because think about what a millisecond in difference on the machines can lead to a complete different result when doing physic simulation.

Tomorrow I’ll have more time, maybe I can put some code together if you can’t fix it your own. good luck.

Oh man, i wrote a novel yesterday - why wasn’t it posted :frowning: ok, again: you don’t want to do rpcs in your tick. imagine it runs like 100 times a sec and on 10 clients, what will the server else be able to do - also when you do it reliable - it’s a lot of workload. what you want is set replicated variables only on the server (switch hasAuthority). Then remember all clients run (simulated) copys of the actors by there self. so if your update position is run on every node, it doesn’t need to be a rpc. but you should experiment with your actor / component replication - you could set for example (in a server rpc) actor to replicate (it’s movement) after pickup, and disable replication after drop. Also only variables of replicated actors replicate themself (if I remember correctly).
hope it helps