Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

2D Space Shooter Sample problem! help!

Discussion in 'Multiplayer' started by mathibesil, Nov 10, 2021.

  1. mathibesil


    Nov 17, 2014
    Hello, I am trying to make a simple game.
    The server is authoritative. I have basically a host and a client.
    From the client i press Space and with [ServerRpc] function i .Spawn() in the server a bullet.
    The bullet has the components:
    - NetworkObject
    - NetworkTransform
    - Rigidbody
    - Network Rigidbody

    On the server i Spawn the bullet and add force to it.
    The bullet repplies on all clients. So the problem is when in the server, the bullet collides.
    Then the server .Despawn() the bullet.
    In the clients the bullet still did not reach the target, because of the interpolation of the NetworkTransform.
    So the bullet in the clients dissaper (Despawn()) before reaching the target.
    The same issue is in the example:
    2D Space Shooter Sample
    Wich is Server Authorative Physics Movement too.

    Here is a video when you can see, left window is the host and right window is the client, as you can see, the projectile never reachs the target on right window.

    Is there a way to fix this?