Non-smooth movement

Options
I've been trying to get players to move smoothly. i tried some smoothing scripts from internet but to no avail... i tried messign around with PhotonTransformView, still jittery.
here is data that i send with SerializeView:

void IPunObservable.OnPhotonSerializeView (PhotonStream stream, PhotonMessageInfo info)
{
if (stream.isWriting) {
stream.SendNext (Health);
stream.SendNext (teamID);
stream.SendNext (transform.position);
stream.SendNext (transform.rotation);
}
else
{
this.Health = (float)stream.ReceiveNext ();
this.teamID = (float)stream.ReceiveNext ();
this.transform.position = (Vector3)stream.ReceiveNext();
this.transform.rotation = (Quaternion)stream.ReceiveNext();
}
}

Comments

  • Shelvid
    Options
    I found solution to this, will leave this just in case you people are struggling in future too:

    create this variables first (i only need to smooth position in my game so i only use that):
    Vector3 realPos = Vector3.zero;


    Run this code in Update method:
    if (!photonView.isMine)
    {
    transform.position = Vector3.Lerp(transform.position, realPos, 0.1f);
    }

    This is what my SerializeView looks like (i only left out smoothing parts so you guys can easily add it):
    void IPunObservable.OnPhotonSerializeView (PhotonStream stream, PhotonMessageInfo info)
    {
    if (stream.isWriting) {
    stream.SendNext (transform.position);
    }
    else
    {
    this.realPos = (Vector3)stream.ReceiveNext();
    }
    }
  • develax
    Options
    This approach still won't give a very smooth movement.