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); } }
0
Answers
-
individual missile sync is a bad idea unless theres only one or two missiles at one time
i would make the missile behave the same way every time its created that way u just sync when the object is created and its direction etc
lerping a rigid body is not a good idea, the missile doesn't need a rigid body unless it uses physics. in addition to this you will NEVER guarantee the missile position on all machines is exactly the same so its a bit pointless trying, you need to focus on making the player believe that it is
hope this helps0 -
With the projectiles in my game. I instantiate a fake projectile for other players. this way the projectile in my view/game does all the damage etc while the projectile in the other guys view is just there for show.0