Verse Library verse

01 Device

Device that automatically moves a specified prop along a defined sequence of waypoint locations at a set speed.

verse-library/fortnite-how-to-make-a-prop-follow-a-path/01-device.verse

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/SpatialMath }

# This is our custom device. Think of it as a new type of device you're inventing.
PathFollower := class(creative_device):

    # @editable means these fields show up in the UEFN Details panel.
    # You can drag and drop items here in the editor.
    
    # The object we want to move (e.g., a boat, a platform)
    PropToMove: creative_prop := creative_prop{}
    
    # How fast it moves (in Unreal Units per second)
    Speed: float := 500.0
    
    # The list of waypoints (flags, cubes, etc.) that define the path
    Waypoints: []creative_prop := array{}
    
    # Internal variables (not visible in editor, used for logic)
    var current_index: int = 0
    var is_moving: bool = false

    # OnBegin runs once when the island starts.
    OnBegin<override>()<suspends>: void =
        # Check if we actually have a prop and waypoints assigned
        if PropToMove != creative_prop{} and len(Waypoints) > 0:
            # Start the movement loop
            _StartMoving()

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