Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

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: