Aller au contenu

FOS Teleport

Ce contenu n’est pas encore disponible dans votre langue.

Version 1.0.0 · requires FOS Essentials Core 1.0.0 or later

One-way A → B teleport, with three triggers. Requires FOS Essentials Core 1.0.0.


Component Trigger Required on the GameObject
FOSTeleportInteract Player interaction (“Use”) A Collider
FOSTeleportTrigger Entering a volume A Collider with Is Trigger enabled
FOSTeleportButton Click on a UI Button A Button referenced in the inspector

All three derive from FOSTeleporterBase, which holds the destination, the options and the move itself. Adding a fourth trigger takes a three-line class.

Menu: Add Component > FOS Essentials > Teleport > ...


  1. Drop the component on the object that triggers the teleport.
  2. Create an empty GameObject where the player should land, rotate it to face the intended direction, and drag it into Destination. Its rotation is used, not only its position.
  3. For the button variant: drag the Button into its field, then click Wire this Button. The OnClick is filled in automatically.

Option Effect
Keep momentum Keeps the player’s speed. Off by default: arriving at full speed makes the player slide or fall.
Align play space VR only. Rotates the whole play space towards the destination, not just the player. Use it when the destination must be faced precisely.
Cooldown Seconds before the teleporter can fire again. 0.5 s by default.
Teleport sound AudioSource played locally. Optional.
On teleport Components notified through the public OnFOSTeleported() event.

Teleporting is local, and that is on purpose

Section titled “Teleporting is local, and that is on purpose”

The VRChat API refuses to move a remote player — ClientSim says so explicitly: “Teleporting remote players will do nothing”. Each client therefore moves its own player. Consequences:

  • no networking, no ownership, no bandwidth;
  • a teleported player is teleported for everyone, because VRChat already synchronises their position;
  • teleporting somebody else is impossible with this component. That would be a different tool, with synchronisation.

OnPlayerTriggerEnter fires on every client, for every player entering the volume. Without filtering, a remote player walking through the trigger would teleport the local player standing on the other side of the world. FOSTeleportTrigger checks player.isLocal before anything else.

If A’s destination sits inside B’s volume and vice versa, the player ping-pongs. The cooldown limits the damage, but the real fix is to place the landing point outside the volume of the facing teleporter.

The cooldown lock is set before the move: teleporting makes the player leave and enter volumes, and those events can come back in the same frame.


A new trigger is just a class deriving from FOSTeleporterBase that calls TeleportLocalPlayer():

using UdonSharp;
using UnityEngine;
namespace FOS.Teleport
{
[UdonBehaviourSyncMode(BehaviourSyncMode.None)]
public class FOSTeleportOnTimer : FOSTeleporterBase
{
private void Start()
{
SendCustomEventDelayedSeconds(nameof(TeleportLocalPlayer), 10f);
}
}
}

Reminder: the class name must match the .cs file name exactly, and the program asset is created on its own the next time the editor loads.