- Home /
 
 
               Question by 
               wolfpack4417 · Jun 24, 2015 at 10:26 AM · 
                movementnetworkingmultiplayersmoothingonserializenetworkview  
              
 
              Smoothing Network Movement with OnSerializeNetworkView
I am trying to smooth my multiplayer movement. I tried to follow this example.
http://answers.unity3d.com/questions/913401/smooth-multiplayer-with-vector3lerp.html
For some reason, the code I have isn't working. This is my code:
     Vector3 realPosition;
     Quaternion realRotation;
 
     NetworkView nView;
 
 
 void Start () 
     {
         nView = GetComponent<NetworkView>();
     }
 
 void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
     {
         if (stream.isWriting)
         {
             bool isWalkingSend = anim.GetBool("IsWalking");
             Vector3 positionSend = transform.position;
             Quaternion rotationSend = transform.rotation;
             stream.Serialize(ref isWalkingSend);
             stream.Serialize(ref positionSend);
             stream.Serialize(ref rotationSend);
         }
         
         else
         {
             bool isWalkingReceive = false;
             stream.Serialize(ref isWalkingReceive);
             stream.Serialize(ref realPosition);
             stream.Serialize(ref realRotation);
             anim.SetBool("IsWalking", isWalkingReceive);
         }
     }
 
 void Update()
     {
         if (!nView.isMine)
         {
             transform.position = Vector3.Lerp (transform.position, realPosition, Time.deltaTime * 15);
             transform.rotation = Quaternion.Lerp (transform.rotation, realRotation, Time.deltaTime * 30);
         }
     }
 
               The animations are being sent perfectly, but the player doesn't move or rotate at all.
               Comment
              
 
               
              Your answer
 
             Follow this Question
Related Questions
Unity networking tutorial? 6 Answers
bouncing a puck of a vertical wall through code 0 Answers
Network Trasnform Interpolation Factor 2 Answers
Rocket Jumping Woes 1 Answer
Movement update doesn't work 0 Answers