Why does using PhotonRigidbody2DView give 'elastic' movement?

128 Views Asked by At

I'm currently using photon pun 2 to learn simple 2d multiplayer.

Using PhotonRigidbody2DView is giving an 'elastic' movement to the player. The player goes forward a bit and then returns to the original position.

Here's the video: https://youtu.be/HgFVsofVZcQ

Why does this happen and how do I solve this?

I tried using PhotonTransformView and PhotonTransformViewClassic but it is giving weird results. The players go inside each other and when one player collides the other, the other player starts jittering.

So I decided to use PhotonRigidbody2DView instead. Now the players don't go inside each other and the jittering is also not happening but the 'elastic' movement problem is happening.

1

There are 1 best solutions below

0
On

This happens because the remote client uses the velocity of the rigidbody to reproduce the movement of the character is does not control. This makes it a bit independent from the lag but for arcade style movement (where direction changes are immediate), this doesn't work all that well.

Solutions to this depend on what you actually need. Networked objects combined with physics can be tricky to get right. For PUN 2, we didn't implement a solution to this case and assumed you'd tweak the PhotonRigidbody2DView as needed.

The Smooth Sync package in the Asset Store seems to do well and is a plugin to PUN 2. Alternatively, the newer Photon SDK "Fusion" should do better and is state of the art as networking solution.