Skip to main content

Saving Current Orientation

As mentioned in the overview, we need to save local player's current orientation to know how to sync their position as well as apply positions of all other players. 

Create a new object, call it Origin, and create a new Udon program for this object. The program should have a public Transform variable that can be set, and an event that when sent, will copy the position and rotation of the transform variable and set itself to that position and rotation. 

Origin UdonGraphOrigin UdonSharpOrigin CyanTrigger

Now we need to update our original buttons to set the transform variable and send the event to this origin object. After teleporting the player, add logic to set the transform variable to the transform of the orientation we are going to. Once set, send the event.

Updated Button UdonGraphUpdated Button UdonSharpUpdated Button CyanTrigger

It is a good idea to set the origin’s transform to the same position and rotation as the first room orientation. This way, by default, all players will appear in the first room, instead of any other arbitrary location.