Im making online game like air hockey. I have problem with sync position.
In the game Player1 and Player2 spawning at bottom. Players moving only between center of the screen and bottom.
My problem is if I'm player1, I need to see player2 in top and player2 need moving only between center of the screen and top.
This code working but if I moving player1, there is no physics on collide with ball in player2 screen.
Note : I have one camera in scene and ball is scene object.
Here is the sample image
https://i.stack.imgur.com/yjxIp.png
Here is the my code
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info){
if (stream.isWriting) {
stream.SendNext (-rigid2D.position);
stream.SendNext (-rigid2D.velocity);
}
}
In the game Player1 and Player2 spawning at bottom. Players moving only between center of the screen and bottom.
My problem is if I'm player1, I need to see player2 in top and player2 need moving only between center of the screen and top.
This code working but if I moving player1, there is no physics on collide with ball in player2 screen.
Note : I have one camera in scene and ball is scene object.
Here is the sample image
https://i.stack.imgur.com/yjxIp.png
Here is the my code
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info){
if (stream.isWriting) {
stream.SendNext (-rigid2D.position);
stream.SendNext (-rigid2D.velocity);
}
}