Instantly Move Game Object to position.

When trying to spawn / move my player (has Photon View and Observed Transform View) from a visible holding area into the map I use transform.position = newPos however on other clients. The player drifts into that spot and sometimes gets caught on colliders between the holding area and the map. How can I instantly move the same player from one position to another on all Clients? An RPC? I've tried a couple variations and nothing seems to work.


  • OneManArmyOneManArmy ✭✭✭
    edited November 2019
    simply check distance between current and real position.
    If distance is higher than x, then instantly move to real position.

    if(Vector3.Distance(transform.position, correctPos) > 5.0f) transform.position = correctPos;

    if you need example, than download sample project from:
  • So it may be that the observed transform view on the non-owner is receiving older messages from where it used to be immediately after being 'jumped' to its new position, and then the PhotonTransformView attempts to smooth between its position for where it's been jumped to and the old position it just received. THEN it received messages from the owner from the new positions, but it's already spent a few frames trying to smooth between the old position and new position, so now its position is somewhere between the two and now it's going to try to smooth from that middle position towards the new position.

Sign In or Register to comment.