Verse Library verse

01 Standalone

Dynamically attaches a keyframed movement component to slide props along a defined path at game start.

verse-library/animate-to-targets-component-verse/01-standalone.verse

using { /Verse.org }
using { /Verse.org/Native }
using { /Verse.org/SceneGraph }
using { /Verse.org/Simulation }
using { /Verse.org/SpatialMath }
using { /Verse.org/SceneGraph/KeyframedMovement }
using { /UnrealEngine.com }

# This is our "Recipe" for the sliding crate.
# <public> means you can see and edit these settings in the UEFN panel.
slide_crates_component<public> := class<final_super>(component):

    # TARGET_POSITION: Where the crate wants to go.
    # Think of this as setting a waypoint on your map.
    TargetPosition: vector = <0,0,0>

    # SPEED: How fast it slides.
    # Higher number = faster. Like setting the speed of a prop-mover.
    Speed: float = 500.0

    # DURATION: How long the slide takes.
    # If you don't set speed, this controls the timing.
    Duration: float = 2.0

    # This is the magic part. We are adding the KeyframedMovement component
    # to this entity when it starts.
    OnBegin<override>() := fun():
        # Get the entity this component is attached to
        entity := Entity(Self)

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