Search Unity

[Solved]NetworkView problem

Discussion in 'Multiplayer' started by AgainstTime, Apr 16, 2010.

  1. AgainstTime

    AgainstTime

    Joined:
    Apr 14, 2010
    Posts:
    84
    Solved
    Hey guys, I have a clynder which is a cannon, his Y axes (up/down) are controlled by the MouseLook script, I want to see when it moves up/down in multi-player, so I attached NetworkView to the cannon,NetworkRigidBody script, and connected the Observed in the NetworkView script to the NetworkRigidbody. It should work, atleast it works with the player's update position and rotation..

    so why doesn't it work with the cannon's position and rotation?

    the problem is that when I see the player's cannon move, it like blinks and disappears to the world, gets back for half a second and then again disappears, like blinks.. Really wierd, anyone have any ideas?
     
  2. jhoemar.pagao

    jhoemar.pagao

    Joined:
    Sep 24, 2009
    Posts:
    27
    Hi,

    I think you need to interpolate the position of the objects and doing some prediction method(see the unity manual for info). Network basically sends data in rate/s. Because network doesn't send all data at all time the values might change in hugely. For example the server reads the current object position with the value of Vector3(0,0,0) on rate 2 then update the data on clients after that the servers reads again the change object position at Vector(10,10,2) and sends the data to the clients. As you observed there is a huge gap between the values. To solve this you need to interpolate and predict the positions as the common solutions for these issues.
    I hope this helps you alot.