[Resolved] PUN player snaps back to origin after being moved

Options
Hello!
So firstly, I am new to PUN and I am still working on figuring out how it works. I am having an issue where the player pawn will return to it's instantiation position after being moved by the Master Client.

The game is simple, there are a series of tiles laid out in a square pattern (currently 5x5) and then the group is centered at 0,0,0 in the world. When all of the players join the room the game is setup. The players all create their pawns, the board is created, and then the pieces are moved using iTween from their initialization position to their appropriate position on the board. The movement of the pawn is forced by the Master Client.

Out of 3 players in the world, which are all using the provided PhotonTransformationView script to serialize their translation matrix, only the local player remains after the movement has stopped.

My thought was that PUN was thinking the sudden movement was a glitch and returning the pawn to it's last origin. I used iTween to move the pawn over 1 second and even after a very smooth transition with multiple frames of movement the pawn still snapped back. This change however doesn't occur on remote clients and their movement appears to never happen except for the pawn owned by the Master Client.

I have tried setting the position instead of lerping it so that the position has a complete jump but that still doesn't solve the lack of movement.

Any help you could provide would be excellent! This is my first time working with multiplayer so it's a whole new kind of thinking. Thank you!

The Fix!!
So from what I could gather objects cannot be moved by anyone but the owner of the game object. So to solve this I used RPC though my game manager to make allow the Master client to "move" the players but simply tell it's controller to move on the client side.

Comments

  • Tobias
    Options
    Good to read you found a workaround.
    Yes, only the owner can move a GO. With PUN v1.50, we now have an option to change the ownership of a PhotonView. If that helps, depends on the specific use case.