Observed rigidbodies positions rotations drift from master

Options
I've got a number of interconnected rigidbodies in my game, so the accuracy of position and rotation across all clients is important because if its out of sync it becomes very apparent very quickly. I'm using unreliable synchronisation because it gives smoother results. In unity networking this works just fine, the rigidbodies do not go out of sync. But in PUN, with all the same settings, they do.
I think the reason for this is that Unity, as well as serialising the translational and rotational velocities, is also serialising the position and rotation of the rigidbodies by default. And it appears in PUN the positions and rotations are not. Am I correct about this or are my observations unexpected behaviour?
To solve this I am considering having a second photonView on each gameObject which observes the transforms, so then both the rigidbody's translational-&-angular velocities and the transform's position-&-rotation are all being sent to the clients. In theory that should give me the same results I was getting with unity's networkView. Does this sound like a suitable solution?

Comments

  • Tobias
    Options
    I wonder if we discussed this topic in another thread. Recently there was a very similar question.

    You are correct. When observing rigidbodies, we don't sync pos and rotation.
    It's very possible to add position and rotation to the synced values and maybe it helps. I bet it can be smoothed and then works pretty nicely.

    However, I doubt that this will really look awesome in all cases. If lag and loss prevents updates from going through, your "simulation" will stutter on the remote clients and it might break immersion. Also, things might be out of sync on the clients and even if you send physically correct positions to the other clients, they might have moved some character in the way and on their machine, the updates don't make sense.
    Especially with interconnected rigidbodies, I think this could be hard to get right.

    You should open NetworkingPeer.cs and look out for "Rigidbody". There are 2 methods for writing the sync updates and to read them. In both you just add pos and rot values accordingly and you might get the results you look for.