Smooth Multiplayer Movement With Vector3.Lerp

What is wrong with my code? I want to smooth the multiplayer movement and get rid of the jitter but using this code doesn’t seem to do the trick.

Vector3.Lerp(this.transform.position, this.GetComponent(NetworkView).transform.position,0.1f);

I have this code on all of my players. I check if the player is theirs and if not I run this code on them.

Just FYI hexagonius Vector3.lerp does work with a constant however it doesn’t produce the effect that I am looking for. Since I literally haven’t found a full answer to this question, only single line codes and references to other descriptions, anywhere I am going to post all of my findings here.

So first off if you use the following code:

transform.position = Vector3.Lerp(transform.position, realPosition, 0.1f);

This will smooth the player movement so much it looks like you are moving on ice. So here is my completed code that is verfied working for anyone else looking to smooth their network player movement(your welcome):

private var realPosition:Vector3 = Vector3.zero;
private var realRotation:Quaternion;
private var sendPosition:Vector3 = Vector3.zero;
private var sendRotation:Quaternion;

function OnSerializeNetworkView(stream : BitStream, info : NetworkMessageInfo) {
		if (stream.isWriting) {//this is your information you will send over the network
			sendPosition = this.transform.position;
			sendRotation = this.transform.rotation;
        	stream.Serialize (sendPosition); //transmit your position to others
        	stream.Serialize (sendRotation); //transmit your rotation to others
       	}else if(stream.isReading){//this is the information you will recieve over the network
       		stream.Serialize (realPosition);//Vector3 position
            stream.Serialize (realRotation);//Quaternion postion
       	}
}
function Update(){
        //The following lines I use Time.deltaTime * <some #> because it is a lot easier to do it this way then to calculate your current position in your overall path....uuuugggghhhhh
	if(!GetComponent.<NetworkView>().isMine){ // make sure to only apply this to network players because crazy stuff will happen to you if you don't :)
		transform.position = Vector3.Lerp(this.transform.position, realPosition, Time.deltaTime * 15);//I multiplied by 15 here and not 30 because it start to create jittery movement again if I went above this number
		transform.rotation = Quaternion.Lerp(this.transform.rotation, realRotation, Time.deltaTime * 30);//For some reason here my rotation looked awesome at multiplying by 30
	}
}

Also here is my attempt at writing it in C#, this one is untested so you might need to fix a few things but the overall idea is there.

private Vector3 realPosition = Vector3.zero;
private Quaternion realRotation;
private Vector3 sendPosition = Vector3.zero;
private Quaternion sendRotation;

void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info) {
		if (stream.isWriting) {//this is your information you will send over the network
			sendPosition = this.transform.position;
			sendRotation = this.transform.rotation;
        	stream.Serialize (ref sendPosition);//im pretty sure you have to use ref here, check that
        	stream.Serialize (ref sendRotation);//same with the ref here...
       	}else if(stream.isReading){//this is the information you will recieve over the network
       		stream.Serialize (ref realPosition);//Vector3 position
            stream.Serialize (ref realRotation);//Quaternion postion
       	}
}
void Update(){
	if(!GetComponent<NetworkView>().isMine){
		transform.position = Vector3.Lerp(this.transform.position, realPosition, Time.deltaTime * 15);
		transform.rotation = Quaternion.Lerp(this.transform.rotation, realRotation, Time.deltaTime * 30);
	}
}

Finally, make sure that you have a network view component on your character and drag this script into that network view. If you did everything right you should have smooth player movement.
PhotonViews, if your using it is going to be setup almost exactly the same, however, I did get better, smoother player movement when I used a constant like 0.1f. I never tried it with Time.deltaTime * 15, so it might even look better. The only thing you would have to worry about is you would have to say:

stream.Serialize(bla bla);//this is to send 
stream.ReceiveNext();//this is to receive

Also change:

OnSerializeNetworkView(stream : BitStream, info : NetworkMessageInfo)

To:

OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)

Everything else in the script will remain the same…I think. Anyway I hope this long answer will help everyone else on the net that I have seen having the same problem.