Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

Wobbling object created with 'Network.Instantiate'

Discussion in 'Multiplayer' started by hoover, Dec 19, 2008.

  1. hoover

    hoover

    Joined:
    Dec 19, 2008
    Posts:
    2
    Hi, I instantiate object over the network. Each object has an NetworkView and a Rigidbody component.

    Client code:
    Code (csharp):
    1.  
    2. public class Client : MonoBehaviour {
    3.  
    4.     public GameObject playerPrefab;
    5.  
    6.     void OnGUI()
    7.     {
    8.         GUILayout.Space (50);
    9.        
    10.         if(GUILayout.Button("Client"))
    11.         {
    12.             Network.Connect("192.168.0.122", 25000);
    13.         }
    14.     }
    15.    
    16.     void OnConnectedToServer()
    17.     {
    18.             Vector3 p=new Vector3();
    19.         for(int i=0;i<15;i++)
    20.         {
    21.             p.y+=3;
    22.                 Network.Instantiate(playerPrefab, p, transform.rotation, 0);
    23.         }
    24.     }
    25. }
    26.  
    Server code:
    Code (csharp):
    1.  
    2. public class Server : MonoBehaviour {
    3.  
    4.     void OnGUI()
    5.     {
    6.         if(GUILayout.Button("Server"))
    7.         {
    8.             Network.InitializeServer(32, 25000);
    9.         }
    10.     }
    11. }
    12.  
    I attached two videos that shows the behavior on the client and on the server. I also attached the complete project.
    As you can see, the objects on the server are wobbeling and moving slower as on the client.

    Can anybody explain why and how to solve it?

    Regards,
    Robert
     

    Attached Files: