Other players spawning and sliding to their positions

Options
Hi,

I'm using Photon Cloud.

After my localPlayer spawned, all the other players are sliding to their 'current' position.
I'm wondering if there is a way to make the other players to directly spawn at their correct position ?

It's bodering me because it's not very clean to see all of them sliding around

Comments

  • Tobias
    Options
    Sure you can change this.
    The reason this is happening is that the Instantiate info is always the one you sent initially. It does not update as the object moves.

    You could add a flag to the sync scripts and remember if there a you ever received a position update. As special rule, don't "lerp" to the position of the first update but directly apply this position.

    You can hide your instantiated objects until the first update set the latest position, too.
  • True, I did not think of that :)
    Thank you for the quick answer.
  • Tobias wrote:
    You could add a flag to the sync scripts and remember if there a you ever received a position update. As special rule, don't "lerp" to the position of the first update but directly apply this position.

    Can you explain this solution in more detail?
  • Tobias
    Options
    Not sure how.
    You write a synchronization script that implements OnPhotonSerializeView. Make it a Photon.Monobehaviour and you get this.photonView. Also add a bool "gotInitialPos"
    In OnPhotonSerializeView you check this.photonView.isMine and if that's false, you also check gotInitialPos. If gotInitialPos is false, apply the received position to the translation. Store the received position in "latestReceivedPos" and set gotInitialPos = true.
  • Oh I misunderstood before. Yes, of course I understand now haha. Thanks!