Search Unity

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: