Verse Library verse

01 Device

Plays and adjusts playback speed of mesh animations when triggered by player interaction.

verse-library/using-animated-mesh-device-in-unreal-editor-for-fortnite/01-device.verse

# This is a simple Verse script for the Animated Mesh Device
# It makes the animation play faster when triggered

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }

# We define our main device
DanceDevice := class(creative_device):

    # This is a reference to the Animated Mesh Device placed on the island.
    # Wire it up in the User Options panel in the editor.
    @editable
    AnimatedMesh : animated_mesh_device = animated_mesh_device{}

    # This is a reference to the Trigger Device placed on the island.
    # Wire it up in the User Options panel in the editor.
    @editable
    DanceTrigger : trigger_device = trigger_device{}

    # This is a variable. It changes the speed.
    # Think of it like a volume knob for speed.
    var speed_variable : float = 1.0

    # This function runs when the game starts
    OnBegin<override>()<suspends> : void =
        # Subscribe to the trigger so OnTriggered runs when a player hits it.
        # This is like telling the doorbell to ring our function.
        DanceTrigger.TriggeredEvent.Subscribe(OnTriggered)

        # We set the animation to start at normal speed

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