Verse Library verse

01 Device

Locks a player camera to a fixed angle when they enter a trigger volume for cinematic sequences.

verse-library/adds-the-camera-to-the-agent-s-camera-stack-and-pushes-it-to-be-the-active-camer/01-device.verse

# Import the core Verse libraries we need
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }

# Define our script component
CinematicTriggerDevice := class(creative_device):

    # This is the camera device we dragged into the editor
    # note: gameplay_camera_fixed_angle_device is the real Verse type for a Fixed Angle Camera device
    @editable
    MyCamera : gameplay_camera_fixed_angle_device = gameplay_camera_fixed_angle_device{}

    # This is the trigger volume device we dragged into the editor
    @editable
    MyTrigger : trigger_device = trigger_device{}

    # This is the time the camera lock lasts (in seconds)
    LockDuration : float = 5.0

    # This function runs when the game starts
    OnBegin<override>()<suspends> : void =
        # Subscribe to the trigger's overlap event so we know when a player enters
        MyTrigger.TriggeredEvent.Subscribe(OnTriggered)
        # Optional: Log a message to the console to debug
        Print("Cinematic Trap Armed!")

    # This function runs when something enters the trigger
    # trigger_device fires TriggeredEvent with the Agent that activated it
    OnTriggered(Agent : ?agent) : void =
        # Spawn a concurrent task so the Wait() does not block the event callback

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.

Sign in with Discord

Comments

    Sign in to vote, comment, or suggest an edit. Sign in