# This is a simple script for the Active Track Volume
# It changes the player's track when they enter the volume
using { /Fortnite.com/Devices }
using { /Fortnite.com/Devices/RacingDevices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
# We create a new device called TrackSwitcher
# This device holds our volume and the target track
TrackSwitcher := class(creative_device):
# This is the volume device we placed in the editor
@editable
ActiveVolume : rr_active_track_volume_device = rr_active_track_volume_device{}
# This function runs when the game starts
OnBegin<override>()<suspends>: void =
# We connect to the "AgentEntersEvent" event
# This means we wait for a player to drive in
# note: rr_active_track_volume_device fires AgentEntersEvent when a racer enters the volume
ActiveVolume.AgentEntersEvent.Subscribe(OnAgentEnters)
# This function runs when a player enters the volume
OnAgentEnters(EnteredAgent : agent) : void =
# We tell the volume to activate for the agent who entered
# note: ActivateForAgent sets the active track on the volume device for this player
ActiveVolume.ActivateForAgent(EnteredAgent)
Verse Library
verse
01 Device
Activates a specific race track volume when players enter, switching their active lap track.
verse-library/using-rocket-racing-active-track-volume-devices-in-unreal-editor-for-fortnite/01-device.verse