using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }
# This is our main script for the door
door_script := class(creative_device):
# We wire the trigger_device in the UEFN editor.
# Place it around the door so it fires when a player walks close.
@editable
DoorTrigger : trigger_device = trigger_device{}
# We wire the prop_mover_device in the UEFN editor.
# It holds the door mesh and handles the sliding movement.
# note: Verse has no free-form MoveObject API; prop_mover_device
# is the real UEFN device for animating props at runtime.
@editable
DoorMover : prop_mover_device = prop_mover_device{}
# This function runs when the game starts
OnBegin<override>()<suspends> : void =
# Subscribe to the trigger so we know when a player is close
DoorTrigger.TriggeredEvent.Subscribe(OnDoorTriggered)
# This function runs when a player gets close
OnDoorTriggered(Agent : ?agent) : void =
# Spawn a concurrent task so Sleep does not block other logic
spawn{ OpenThenCloseDoor() }
Verse Library
verse
01 Device
Uses asynchronous spawning and suspension to move a door without blocking the main thread.
verse-library/getting-started-in-scene-graph-in-fortnite/01-device.verse
Sign in free to read the full source 🌴
This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.