Unity Ninja Unity 3D Forum
To have exclusive access to all downloads, recourses and links within this forum, a free registered account is required. Just a heads up Wink
Share
Go down
Member [Lv. 0]
Member [Lv. 0]
Posts : 1
Points : 1003
Rep : 0
Join date : 2015-10-24
View user profile

Please can someone help me with this multiplayer (photon) issue?

on Sat Oct 24, 2015 9:35 pm
I have been trying to fix this for about a week, and i've asked on Unity answers but haven't had any help. For some reason, the other player has stuttering / laggy movement on my player's screen. Please could someone tell me how to fix it, I would appreciate it a lot. Here is the code to move the player (simplified):


Code:
  public Rigidbody2D rb2D;
 
        void Update () {
        Vector3 targetPos = new Vector3(369.1f, -188.9f, -0.1f);

        rb2D.transform.position = Vector3.Lerp(rb2D.transform.position, targetPos, Time.deltaTime * 0.06f);

    }




And the code to view the other player:

Code:

public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
    {
        if (stream.isWriting)
        {
            //We own this player: send the others our data
            stream.SendNext(rb2D.transform.position);
            stream.SendNext(rb2D.transform.rotation);
        }
        else
        {
            //Recieve other player
            realPosition = (Vector3)stream.ReceiveNext();
            

        }
    }



I have a photon view and the player is a Rigidbody2D

Thanks a lot!
Back to top
Permissions in this forum:
You cannot reply to topics in this forum