Verse Library verse

01 Device

Continuously moves a prop up and down using a time-based sine wave calculation.

verse-library/create-dynamic-movement-in-unreal-editor-for-fortnite/01-device.verse

# This is our main script
# It connects to the Prop we placed
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }

# We create a special device for our code
# creative_device is the real base class for island scripts
my_moving_prop := class(creative_device):

    # This is the prop we want to move
    # It is like a named slot for the object
    # Mark it @editable so you can assign it in the UEFN details panel
    @editable
    Prop : creative_prop = creative_prop{}

    # This is a variable for speed
    # Variables can change their value
    var Speed : float = 2.0

    # This function starts the action
    # It runs once when the game begins
    OnBegin<override>()<suspends> : void =
        # We enter a loop here
        # A loop repeats code forever
        loop:
            # Get the current time in seconds
            # Time is always moving forward
            CurrentTime := GetSimulationElapsedTime()

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