A good way of sharing an object?

Hi everyone
Earlier I tried using Truesync for making a football game. But now I've switched to Photon networking.

I have searched google and the forums and there have been other cases of people making football games, where they as k how to share the ball between players.

My setup is portrait mode where you are able to control your players position with your mouse/finger directly for half the screen (you can't move to the opponents side). The players are moved by using rigidbody2D and rigidbody.moveposition so the movement of the mouse/finger is added to the ball when hit.

Now, this only works for the master client, but my solution was to switch ownership of the ball every time the player hits the ball. This cases a small lag/jitter and sometimes the ball behaves weirdly.

I just tried changing the balls to triggers and then when they hit the ball, they send their direction + a speed to the ball through an RPC. This isn't a good solution, as it takes a small amount of time before it is updated on the other player.

Now I want the player to be able to sort of dribble the ball, so there has to be collisions (no triggers). But I'm not sure how to limit the force added to the ball. Nor am I not sure how I fix the lag problem.

I'm sure sharing something like a ball or other items has been done before (look at FIFA or Rocket League).
Can anyone help ? :smile:
Sign In or Register to comment.