using { /Fortnite.com/Devices } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } # PRESS TO PERFORM — drive a skeletal mesh from Verse. # # The Animated Mesh device is the creator-friendly door to skeletal animation. # You can't hand-build an `animation_sequence` in Verse code (those are # editor-imported assets, and the play_animation_controller that consumes them # is epic_internal). What you CAN do is pick a skeletal mesh and an animation # IN THE EDITOR on an Animated Mesh device, then drive its playback from Verse # with Play / Pause / PlayReverse. # # This device turns one Button into a full transport panel for a posed statue, # a dancing hologram, a swinging gate — any skeletal mesh you drop on the # Animated Mesh device. First press plays, next pauses, next reverses, and so on. skel_performer_device := class(creative_device): # The skeletal-mesh performer. Choose its mesh + animation in the editor. @editable Statue : animated_mesh_device = animated_mesh_device{} # One button cycles through Play -> Pause -> Reverse. @editable ControlButton : button_device = button_device{} # Which state the next press should APPLY. Starts at "play". var Step : int = 0 OnBegin() : void = ControlButton.InteractedWithEvent.Subscribe(OnPress) # Each press advances the transport: Play, then Pause, then PlayReverse, # then back to Play. The Animated Mesh device remembers its own playhead, # so Pause freezes mid-animation and Play resumes from there. OnPress(Presser : agent) : void = case (Step): 0 => Statue.Play() Print("Animated Mesh: Play") 1 => Statue.Pause() Print("Animated Mesh: Pause (frozen on current frame)") _ => Statue.PlayReverse() Print("Animated Mesh: PlayReverse") # Advance, wrapping 0 -> 1 -> 2 -> 0. Verse has no `%` operator; the # built-in Mod[] is the failable modulo (it fails only on divide-by-zero, # which can't happen here). The if simply re-binds Step to the result. if (Next := Mod[Step + 1, 3]): set Step = Next