- Home /
 
               Question by 
               julienfouilhe · Nov 19, 2013 at 09:00 PM · 
                movementnetworkingcharactercontrollernetwork  
              
 
              Moving another player character on Network
I'm trying to push another player character on the network when we collide. The problem is that when I do that, only I can see the character moving.
I use :
 controller.Move(vect * Time.fixedDeltaTime);
controller being a CharacterController and vect being set correctly.
I don't understand since I call the same method to move my own player and it works properly.
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by Josh1231 · Nov 19, 2013 at 09:05 PM
 function OnSerializeNetworkView(stream : BitStream, info : NetworkMessageInfo) {
send the positions in that http://docs.unity3d.com/Documentation/ScriptReference/MonoBehaviour.OnSerializeNetworkView.html
example (in C#):
 void OnSerializeNetworkView(stream : BitStream, info : NetworkMessageInfo)
    {
    Vector3 position = new Vector3(0,0,0);
    if (stream.isWriting)
       {
       position = transform.position;
       stream.Serialize(ref position); //javascipt doesn't need ref
       }
    else
       {
       stream.Serialize(ref position);
       transform.position = position
       }
    }
I resolved my issue using an RPC message, is this a better way to do it ?
if you want to do it like this you can but there is other ways of doing it
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                