Synchronizing a missile (projectile)
Options
Hello everyone, I'm having trouble synchronizing a bullet in my game! It behaves like a missile, and I need to make sure the projectile is in the same position on all machines!
Doing a position compensation, I can not guarantee that! I know I'm doing something wrong, because we see this guarantee in some games, like the Pharah missile in Overwatch, or the rocket launchers in Quake Arena, etc...
Doing a position compensation, I can not guarantee that! I know I'm doing something wrong, because we see this guarantee in some games, like the Pharah missile in Overwatch, or the rocket launchers in Quake Arena, etc...
private void FixedUpdate() { if (PhotonNetwork.isMasterClient) { myRigidbody.MovePosition(myTransform.position + myTransform.forward * Time.deltaTime * speed); } else { lerpFraction = lerpFraction + Time.deltaTime * 9; myRigidbody.position = Vector3.Lerp(currentPosition, networkPos, lerpFraction); } }
void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (stream.isWriting) { stream.SendNext(myRigidbody.position); } else { networkPos = (Vector3)stream.ReceiveNext(); currentPosition = myRigidbody.position; lerpFraction = 0f; } }
1