I have a small problem with physics object locations when players join my game in progress.
The physics objects are important in my level so I have them spawned on the level. They’re not being spawned from blueprints or scripts or something like that.
The problem only occurs if the physics object has been moved from its starting location when the client joins.
The problem is that if a physics object gets moved before a new client joins, the client will see the object at the original location, not the new one.
Ofcourse the client won’t be able to do anything to the object he sees, since the real object with collision is at the new location.
The objects are marked as “Replicated”, however the replication does not seem to trigger unless the object gets moved after being loaded on the clients.
As soon as the host (who sees the correct location) bumps the object, it’ll get synced for the clients and everything works fine from now on.
I tried adding a loop that gets triggered and runs server side that then gets the object location and triggers a client side event which uses the location and moves the object to it. However it does not seem to be that simple with objects that are loaded in the level.
Here’s a messy blueprint screenshot, it’s mainly the stuff marked inside the orange circle. I tried having the “client” event replicated as “run on owning client” with same results. although its not set to that in the screenshot.
On clients, nothing executes in that blueprint, and on the server it’ll loop and run through the authority switch. Even with the event set to “Run on owning client”, it’ll only execute on the server.
Maybe (probably) I’m missing something relatively simple.
TLDR
I need to find a way to constantly update the location of a physics object that spawns with the level for any client that joins once the game has started.
Currently I’m only able to run any “set location” nodes only on the server so it won’t get synced to clients. However it gets synced if the host moves the object.
The objects are marked as “Replicated”.