I have a host and a client, a client wants to pick up a box, move it and drop it. When it’s dropped, the server gets to move it.
To pick up the box, I give ownership to the player using ChangeOwnership(). Works fine.
The player can then move the box using ClientNetworkTransform. Works fine.
When the player drops the box, I remove ownership using RemoveOwnership(). Ownership is returned to the server.
Expected - the box stays in the place the player moved it to. Actual - the box springs back to the original location as if the player never moved it.
Is this intentional or a bug? If it’s a bug, I’ll raise. If there’s no answer, I’ll raise as a bug.
If intentional then it implies and object can either be moved always by the client or always by the server but cannot be changed at runtime. If that’s the case, then I am curious about what Change/RemoveOwnership is for.
This is a long-time bug that I’ve learned to work around. What seems to happen is that the server caches the last transform change it authored, and when it then receives ownership again it reapplies that. A workaround is to overwrite that transform by what it should be the moment the server gains ownership again, through ServerRpc/ClientRpc. To be safe I set the transform on all clients so all cached values are overwritten, even if they don’t have ownership, and call SetState on the ClientNetworkTransform on the owner.
I should note that this seems to be less of an issue since 1.0.1 – are you still on 1.0.0 by any chance?
I am still on 1.0.0 and will gladly upgrade. Your analysis definitely matches what I’m seeing. Thanks for your work around, I was heading in that same direction.
Thanks to @CreativeChris for the update. I’m mid-development so I can work around for now and make use of the Client Network Transform update when it arrives. I appreciate that moving away from Rpc to the ownership NetworkVariable would be a great improvement.