menu_bookDocumentation
Sandbox: Map entities — Door, Button, FuncMover, TriggerPush, TriggerTeleport
Sandbox Map Entities — Door, Button, FuncMover, TriggerPush, TriggerTeleport
These components implement interactive map elements. They live in the Facepunch namespace and use Component.IPressable for player interaction.
Door
Door implements Component.IPressable and animates rotation around a pivot point using an AnimationCurve.| Property | Default | Description |
|---|---|---|
| TargetAngle | 90° | How far the door rotates when opened |
| OpenTime | 0.5s | Duration of open/close animation |
| OpenAwayFromPlayer | true | Rotates away from the pressing player |
| IsLocked | false | Synced — locked doors play LockedSound and don't open |
| Pivot | null | Optional pivot GameObject; uses origin if unset |
| AnimationCurve | linear | Controls easing of the open/close animation |
The door fires OnStateChanged (an Action<DoorState>) when state transitions occur. Open/close can be triggered via [ActionGraphNode] RPCs: sandbox.door.open, sandbox.door.close, sandbox.door.toggle.
Button
Button implements Component.IPressable. When pressed, it fires an output event and optionally triggers a linked BaseToggle. Supports a cooldown to prevent rapid re-triggering.FuncMover
FuncMover moves a GameObject between two positions (or along a path) over time. Used for elevators, sliding platforms, etc. Supports:- Linear and curved movement
- Speed and acceleration settings
- Start/end position defined by child GameObjects or offsets
- IPressable integration to trigger movement
TriggerPush
Applies a continuous force to any Rigidbody that enters the trigger volume. Useful for wind zones, fans, jump pads.
| Property | Description |
|---|---|
| Force | Force magnitude |
| Direction | Push direction (world-space) |
| AffectsPlayers | Whether to push player controllers |
TriggerTeleport
Teleports any entity that enters the trigger to a target transform. Supports:
- Destination — target GameObject whose transform is used
- PreserveVelocity — whether to keep the entity's velocity after teleport
- Player teleportation via PlayerController position override
IPressable pattern
CSHARP
public interface IPressable
{
public class Event
{
public Component Source { get; init; } // The pressing component (e.g. PlayerController)
public GameObject GameObject => Source?.GameObject;
}
bool CanPress( Event e ) { return true; }
bool Press( Event e );
}Implement IPressable on any component to make it interactable with the player's use key. The player's PlayerController calls CanPress then Press on the nearest valid IPressable in range.
Key points
- Door.IsLocked is [Sync] — the host sets it, all clients read it
- Door.Toggle checks State is DoorState.Open or DoorState.Closed before allowing interaction
- FuncMover and Door use TimeSince for animation timing — no coroutines needed
- All map entities are in the Facepunch namespace, not the global namespace
Was this helpful?