Verse Library verse

01 Device

Plays or stops editor-chosen animations on the player who presses a button.

verse-library/verse-play-animation-on-character/01-device.verse

using { /Fortnite.com/Characters }
using { /Fortnite.com/Animation/PlayAnimation }
using { /Fortnite.com/Devices }
using { /Verse.org/Assets }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

# PLAY AN ANIMATION ON A PLAYER'S CHARACTER — directly, from Verse.
#
# Before the /Fortnite.com/Animation/PlayAnimation module, playing an animation
# on the *player's own character* meant hacks: spawning a hidden NPC, swapping
# meshes, or driving an Animated Mesh device standing in for the player. Now the
# path is a straight line:
#
#   1. agent  -> fort_character          Presser.GetFortCharacter[]
#   2. character -> play_animation_controller
#                                        Character.GetPlayAnimationController[]
#   3. controller.Play(sequence, ...)  -> play_animation_instance
#
# The instance is a remote control for that one playback: Stop it, read its
# GetState, or subscribe to its CompletedEvent / InterruptedEvent.
#
# This device wires two buttons: one plays an editor-chosen animation sequence
# on whoever pressed it, the other stops the most recent playback.
play_emote_on_press_device := class(creative_device):

    # The animation to play. You CANNOT build an animation_sequence in Verse
    # (its constructor is epic_internal) -- it's an editor-imported asset. So the
    # slot is an OPTION: pick the asset in the device's Details panel in UEFN,
    # and we unwrap it at use with `EmoteAnim?`.

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