По какой-то причине движение другого игрока «заикается». Я знаю, что это обычная проблема, с которой сталкиваются люди с Photon, поэтому было интересно, знает ли кто-нибудь, как я могу ее решить?Как исправить многопользовательское заикание?
Вот мой игрок код движения:
public float SmoothingDelay = 5;
public void Start()
{
GetComponent<SmoothSyncMovement>().enabled = true; //This is the name of this script
}
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
if (stream.isWriting)
{
//We own this player: send the others our data
stream.SendNext(rb2D.position);
stream.SendNext(rb2D.rotation);
}
else
{
//Network player, receive data
correctPlayerPos = (Vector3)stream.ReceiveNext();
}
}
public void Update()
{
if (!photonView.isMine)
{
Vector2 playerMovement = rb2D.position + velocity * Time.deltaTime;
rb2D.MovePosition(playerMovement);
}
if (photonView.isMine)
{
Vector2 playerMovement = rb2D.position + velocity * Time.deltaTime;
rb2D.MovePosition(playerMovement);
}
}
Та же тема обсуждалась на форуме ExitGames: http://forum.photonengine.com/discussion/6821/other-players-have-flashing-stuterring-movement – photonians