Verse Library verse

01 Standalone

Defines an abstract moving prop base and a concrete translating platform that slides continuously.

verse-library/1-making-movable-props-with-verse/01-standalone.verse

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

# This is our blueprint for any moving object.
# It is abstract, so we cannot use it directly.
movable_prop<public> := class<abstract>():
    # This is the object we will move.
    # It is a "creative_prop" in Fortnite terms.
    # Wire your placed prop to this slot in the Verse Device details panel.
    Prop<public>: creative_prop = creative_prop{}

    # This is where we start moving.
    Start_Position<public>: vector3 = vector3{X := 0.0, Y := 0.0, Z := 0.0}

    # This is where we want to go.
    End_Position<public>: vector3 = vector3{X := 0.0, Y := 0.0, Z := 0.0}

# This is the specific type of moving object.
# It inherits from movable_prop.
# It knows how to translate (slide).
translating_prop<public> := class<concrete>(movable_prop):

    # This function runs once when the game starts.
    # It sets up the platform.
    OnBegin<override>()<suspends>: void =
        # Start the movement loop on its own thread
        # so it does not block the rest of the level.
        spawn { Start_Movement() }

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