Verse Library verse

09 Scaling Prop Verse

Animates a prop to match another Creative prop's scale using eased movement functions.

extracted-snippets/documentation/en-us/uefn/animating-prop-movement-5-scaling-props-in-verse/09-scaling-prop-verse.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/uefn/animating-prop-movement-5-scaling-props-in-verse
# Local doc:  epic-docs/documentation/en-us/uefn/animating-prop-movement-5-scaling-props-in-verse.md
# Section:    scaling\_prop.verse
using { /Fortnite.com/Devices }
using { /Fortnite.com/Devices/CreativeAnimation }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/SpatialMath }

MatchScaleTargetTip<localizes>:message = "The optional position to move to World Space. Use this if you do not want to set a MoveTarget."

# A prop that scales towards either a given scale or a creative prop's scale.
scaling_prop<public> := class<concrete>(movable_prop):

    # The array of vector3 targets for the RootProp to scale to.
    @editable {ToolTip := MoveTargetsTip}
    var ScaleTargets:[]vector3= array{}

    # The optional creative prop for the RootProp to match scale to.
    @editable {ToolTip := MatchScaleTargetTip}
    var MatchScaleTarget:?creative_prop = false

    # The scale the prop is currently targeting.
    var TargetScale:vector3 = vector3{}
    
    # Scale the RootProp towards the ScaleTarget, or MatchScaleTarget if one is set.
    Move<override>()<suspends>:void=

        # Set the TargetScale to the MatchScaleTarget if it is set. 
        if:
            ScaleToMatch := MatchScaleTarget?.GetTransform().Scale

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