Rigidbody velocity [punch client]

Hi guys , I Have punch human . they punch each other when they stand in front of each other.

this is my part of script :

public void Punch(Transform other)
  {
    if (canPunch && photonView.IsMine)
    {
      canPunch = false;
      anim.SetBool("Attack", true);
      StartCoroutine(ResetPunch());
      PlayerMultiplayer tempPlayerScript = other.GetComponent<PlayerMultiplayer>();
      photonview.RPC("PunchToOtherClinet", RpcTarget.AllBuffered, tempPlayerScript.photonview.ViewID);
    }
  }
  [PunRPC]
  private void PunchToOtherClinet(int viewIDOfPlayer)
  {
    PlayerMultiplayer obj = PhotonView.Find(viewIDOfPlayer).GetComponent<PlayerMultiplayer>();
    Rigidbody _rb = obj.gameObject.GetComponent<Rigidbody>();
    _rb.velocity = transform.forward * PunchForce;
    obj.Puncher = transform;
    obj.StartCoroutine(obj.stun());
  }

it works fine , but it syncs a bit late . [ping around 80 100ms] there is any better Solution? any suggestion ? I think I should not use RPC but I did not find another way .

is there a way for the client to punch(RigidBody.velocity) another client local and sync them automatically (Rigidbody View photon) ?

thanks anyway 😘

Answers