Sync player transform

M4TT
M4TT
Hi everyone, I'm getting stuck since 3 weeks with this sync over photon.

There is the problem :



This is not my screen but that's exactly whats happens in my game.
I searched everywhere to move on but I'm starting to give up ...

Well, I tried many script ( lerp, extrapolate, smooth move, this one,) Ive wacth many video on youtube about this topic, and I know that this topic has been treated many times but I just dont understand why the result is always the same :[
I have already asked for help on the net but it was not very beneficial : https://answers.unity.com/questions/1447362/photon-syncing.html?childToView=1449501#comment-1449501

What I managed to synchronize (it seems to me) is the rotation.

The best rendering I have for the moment is with this script :
    private void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
    {
        if (stream.isWriting)
        {
            stream.SendNext(transform.position);
            stream.SendNext(transform.rotation);
        }
        else
        {
            TargetPosition = (Vector3)stream.ReceiveNext();
            TargetRotation = (Quaternion)stream.ReceiveNext();
        }
    }
    private void SyncMove()
    {
        transform.position = Vector3.Lerp(transform.position, TargetPosition, 1f);
        transform.rotation = Quaternion.RotateTowards(transform.rotation, TargetRotation, 500 * Time.deltaTime);
    }
Thank

Comments

  • Did u tryed PhotonTransformView ?
  • Yes with all the options availaible ... ( lerp / interpolation / extrapolation )
  • Any suggest ?
    I cant resolve that problem since many weeks, any help is welcome :]
  • would u share ur project with me ?than i take a closer look
  • Thank you for help @S_Oliver.
    But the Ive still the same issue.
    I tried many settings with the PhotonTransformView and every time the same result.
    Would someone have a synchronization code for me please ?
    I'm just using a that transform.Translate in the void Update.
  • Hi, @S_Oliver
    I also Have synchronization problem.
    Could you solve this?
    It is 2D ball game.
    I can share codes.