Search Unity

Help Wanted [Mirror] Non-host player shakes and jitters rapidly when colliding with another object.

Discussion in 'Multiplayer' started by SkyBoltAsher, Feb 2, 2021.

  1. SkyBoltAsher

    SkyBoltAsher

    Joined:
    Nov 19, 2020
    Posts:
    1
    Hello, I've been experiencing a problem with getting multiplayer to work smoothly with Mirror. I have a ship object that has colliders around the edge.

    When the ship moves, non-host players within it start to jitter and shake. The player continues to shake forever. The players are moved by forces being applied client side, and they have network transforms and rigidbody2ds, each with client authority. The ship moves by a player getting into the top center, and pressing a key. The player gets authority of the ship, which also has client authority on its network components, then a force is applied to the ship in a method called by the player with authority. This force is applied client side. the ship moves as expected, but when the "pilot" is a non-host player, they jitter, as shown in this video.

    Likewise, if the host player "pilots" the ship, the non-host player will start to jitter once the walls of the ship reach them and they collide. The jitter also seems to occur when the players collide with each other, but only to a small extent. Another note is that when I view the rigidbody of the jittering player in the inspector, it's velocity changes erratically within a small margin, likely caused by the jitter. Both the ship and player rigidbody2ds are of type dynamic.

    I have tried setting the player body type to static or kinematic on non local players, but the same problem occurs, and the players stop being able to move each other, which is what I want. I have also tried having all objects in the scene be only dynamic on the server side, and having all movement done by the server, but the problem persists.

    When the only active script in the scene is one that applies a force to the ship, the problem persists, which leads me to believe it is not a code issue, but one with how I am treating collisions and network components. Any help is much appreciated.
     

    Attached Files:

unityunity