Reverse position vertical game

Options
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);
}
}

Answers

  • bekmekci
    Options
  • Hi @bekmekci,

    in your code example you are using a 2D Rigidbody component, however your youtube links seems to show a 3D world. Is your game 2D or 3D?

    In both cases you can simply create two different logic peaces: one handles the first player on the bottom half of the playing are, and the the other the second player on the top side of the area. When pressing forward / 'doing a forward move', both player should get closer to center. Make sure that non of the players can leave their assigned area.

    To get the look and feel you want to achieve you need to adjust the camera for each player. The first player is easy because you can set up the correct camera angle in the editor. Assuming that the LookAt target of the camera is the center of the playing area, you can simply move the camera for the second player on the other side of the area, making sure that it still looks at the center position.
  • Tobias
    Options
    @bekmekci: When you reject answers, please update your question to let us know why they don't fit and where you're stuck. Otherwise, we can't help properly.