Question about physics.

Options

As we know Unity physics is not deterministic so I cant use physX calculations over the network BUT what if I have all entities with rigidbody with freezed constrains and on collision unfreeze the constrains only on entity.isowner. Then physics start working only for him and with it transform of object is changing... Transform is observed by network so with short stutter but position of object should be updated for other players. To dont keep the physics work all the time I can use courutine which is switching constrains on/off after 1sec so transform should catch up with physics after that or sometime in the middle...
Is there a mistake in my understanding?

Answers

  • Hello @buhu ,

    Yes, that can be a solution, but not sure how smooth it would be when synchronizing the positions.

    You can use the server authoritative approach and let your players just send movement commands, the server will simulate the movement and replicated back the result.

    If you want to do local prediction, things get more complicated.
    One solution would be to simulate the command input on a separate physics scene and update the local client based on the result of this simulation. Later the server will respond with the real result, and you need to smoothly blend between the values.

    --
    Ramon Melo
    Photon Bolt Team
  • buhu
    Options

    I already did what I chaotically explain in my first post and its working.
    For now I'm only testing, later project will be pushed to server and I guess then this whole collision mechanics will have to be reworked.
    Thanks for answer.