This feature requires Unreal Editor for Fortnite (UEFN) version 41.00 or newer. The Verse APIs described here are subject to change while the feature is experimental, and you currently cannot publish islands that use this feature.
Enable Scene Graph Animation
This is an experimental feature you can enable in your Project Settings. Once enabled, your project can compile the code syntax and examples below.
To enable scene graph animation in your project, follow these steps:
In UEFN, open Project Settings.
Go to the Experimental section.
Select the Scene Graph Animation checkbox to enable it.
When UEFN shows this confirmation message:
"Enabling Scene Graph Animation may break compatibility with your existing Verse code and cause it to fail compilation."
Confirm to enable the feature.
If you have an in-progress project, you may need to fix Verse compilation errors after enabling this feature.
Enabling this flag changes the Verse asset digest the editor generates for your project. With the flag on, every animation asset in your project is exposed to Verse as a concrete subclass of skeletal_animation, which is what makes PlaySkeletalAnimation work. With the flag off, those subclasses don't exist and the API isn't usable. For legacy APIs that require animation_sequence instances to function, these instances are now exposed with the _asset postfix in their name.
Entity Prerequisites
For PlaySkeletalAnimation to succeed on an entity, the entity must have:
A
mesh_componentattached to it.That
mesh_componentmust reference a skeletal mesh asset (not a static mesh).
If the entity has no mesh_component or the mesh_component corresponds to a static mesh, the call will fail.
Skeletal Animation API
Use the following Verse class, method, and struct to control skeletal animation in Scene Graph.
skeletal_animation
skeletal_animation<public> := class(modifier(skeleton))A skeletal_animation is a modifier that, when added to a mesh's skeleton modifier stack, produces a pose every frame from an underlying animation asset.
Creators do not hand-author skeletal_animation subclasses. Once the Scene Graph Animation flag is enabled, every animation sequence asset in a project is automatically exposed as a concrete subclass of skeletal_animation.
For example, an animation sequence asset at Character/Animations/Idle appears in Verse as the class Character.Animations.Idle. To play that animation, construct an instance of it (for example, Character.Animations.Idle{}) and pass it to PlaySkeletalAnimation.
(Entity:entity).PlaySkeletalAnimation
(Entity:entity).PlaySkeletalAnimation<public>(
Animation:skeletal_animation,
?EaseInWindow:easing_window = easing_window{},
?EaseOutWindow:easing_window = easing_window{}
)<decides><transacts> : play_skeletal_animation_resultAdds the given animation as a modifier on the entity's skeletal mesh, with an easing modifier wrapping it so it blends in and out smoothly.
| Parameter Name | Type | Default | Description |
|---|---|---|---|
|
| An instance of a concrete | |
|
|
| Optional. Controls the blend-in. The default |
|
|
| Optional. Controls the blend-out used when the returned handle eases out. Can be overridden at ease-out time by passing a window to |
play_skeletal_animation_result
play_skeletal_animation_result<public> := struct:
Animation : skeletal_animation
Easeable : easeableThe return value of PlaySkeletalAnimation.
| Field | Type | Description |
|---|---|---|
|
| The animation instance that was played (the same value that was passed into |
|
| A handle that can be used to ease the animation back out, override the ease-out window, or cancel it instantly. See "Ending an animation," below. |
End an Animation
There are three options for ending a playing animation. All three operate on the Easeable field of the play_skeletal_animation_result returned from PlaySkeletalAnimation.
| Form | Behavior | Use Case |
|---|---|---|
| Ease out using the | The most common case. Configure the ease-out at play time and forget about it. |
| Ease out using the supplied window, overriding the ease-out window set when | When the right ease-out depends on runtime context. For example, a different blend for an interrupted action versus a natural finish. |
| Remove the animation instantly. Equivalent to | When the animation needs to be removed instantly or the player won't see the change. |
Because Cancel() removes the animation with a zero-duration ease-out, the resulting pose snaps to the underlying base pose. If an animation is the top-weighted modifier the player is currently looking at, that snap is visible as a one-frame pop. Use Cancel() when the animation being cancelled isn’t visible. For example, a queued idle that's been fully blended over by a higher-priority action animation. When the animation is visible, use EaseOut with a non-zero Duration so the transition reads as a blend rather than a pop.
Examples
The animation class names (Character.Animations.Idle) come from the auto-generated digest for a project that contains the corresponding assets; in your own project, substitute whatever module and class names your assets produce.
Play an Animation with Default Easing
The simplest call. Both ease windows default to a 0.3-second EaseInOut blend.
OnTrigger(Entity:entity)<transacts>:void =
# Idle is auto-generated from an animation sequence asset
# in your project, under a module matching the asset's path.
Entity.PlaySkeletalAnimation[Character.Animations.Idle{}] or falseTune Easing Windows
Pass an explicit easing_window to control the blend. The first call disables easing entirely; the second uses a custom cubic-Bezier ease-in over 0.5 seconds.
# Instant change — no blend in or out.
Entity.PlaySkeletalAnimation[
Character.Animations.RunFwd{},
?EaseInWindow := easing_window{Duration := 0.0},
?EaseOutWindow := easing_window{Duration := 0.0}
] or false
# Half-second custom-curve ease-in; default ease-out.
Entity.PlaySkeletalAnimation[
Character.Animations.RunFwd{},
easing_window also has an Offset field that allows delaying the start of the ease window relative to the animation’s internal timeline.
Keep the Result Handle and End the Animation Later
Store the returned play_skeletal_animation_result and use its Easeable field to end the animation at a later time. This example shows all three ways to end an animation.
OnPlay(Entity:entity)<suspends>:void =
if:
Playing := Entity.PlaySkeletalAnimation[
Character.Animations.IdleBreak{},
?EaseInWindow := easing_window{Easing := Easing.Ease, Duration := 1.0}
]
then:
Sleep(3.0)
# (a) Ease out using the window provided at PlaySkeletalAnimation time.