Teleport-like abilities while using Photon Transform View

Hello!

I'm new with Photon and am wondering what the best-practice is for this type of a functionality. So basically if I have a player using a teleport skill, on the remote users I want them to see the player teleport, not lerp into position using the standard Photon Transform View.

I can think of a couple of ways of doing this:
1. Writing my own transform sync code entirely, using either RPCs or OnPhotonSerializeView and choosing how to handle the position coordinates based on the distance to the previous position
2. Add a reference of Photon Transform View to the script that controls the player position. If previous position has enough distance to next position, toggle transform sync off, do the teleport, sync the new position manually and re-
enable Photon Transform View when the updated position has been synced.

1. seems easier, but am I missing some important and useful functionality by choosing not to use Photon Transform View... Is either method considered "supreme", is there some other really good way that I'm not thinking of or does the best practice always vary case by case?

Comments

  • I'm having this same problem with Teleporting and when I move the player to respawn them, did you come up with a solution yet?
  • Sorry I missed your question.

    I went with the solution 1 in my original post so:

    "1. Writing my own transform sync code entirely, using either RPCs or OnPhotonSerializeView and choosing how to handle the position coordinates based on the distance to the previous position"

    So basically I'm choosing when I want to sync the position, and if the position difference between last and next position is bigger than the threshold for teleportation, I'll visualize a teleport instead of just lerping between the positions.
  • Hello,
    I would like to re-open this old post. I implemented the same solution:
    "1. Writing my own transform sync code entirely, using either RPCs or OnPhotonSerializeView and choosing how to handle the position coordinates based on the distance to the previous position"

    in my case using RPC. It seems working well at the beginning but somehow the clients positions at some point go off-sync, specifically:
    • User A and B join the same room (their avatar get created in fixed position Pa and Pb)
    • User B disconnects
    • User A teleports around
    • User B re-connects
    • User A (for user B perspective) get position in the starting position Pa instead in the last one

    It looks like User B doesn't get all the previous teleport events (RPC) he missed while being outside the room.
    For the records, I setup PhotonView for both LocalAvatar and RemoteAvatar to Unreliable in order to get immediately the events when joining the room, but it didn't work. Am I missing some other option?

    Any idea?
  • BFX wrote: »
    Hello,
    I would like to re-open this old post. I implemented the same solution:
    "1. Writing my own transform sync code entirely, using either RPCs or OnPhotonSerializeView and choosing how to handle the position coordinates based on the distance to the previous position"

    in my case using RPC. It seems working well at the beginning but somehow the clients positions at some point go off-sync, specifically:
    • User A and B join the same room (their avatar get created in fixed position Pa and Pb)
    • User B disconnects
    • User A teleports around
    • User B re-connects
    • User A (for user B perspective) get position in the starting position Pa instead in the last one

    It looks like User B doesn't get all the previous teleport events (RPC) he missed while being outside the room.
    For the records, I setup PhotonView for both LocalAvatar and RemoteAvatar to Unreliable in order to get immediately the events when joining the room, but it didn't work. Am I missing some other option?

    Any idea?


    yes if you want User B to get all the previous teleport events (RPC) he missed while being outside the room
    Use "RpcTarget.AllBuffered" as target of your those RPCs which you want B to get while he was outside the room.