Language:
Page Info
Skill Level:
Engine Version:
Share
此中文页面内容对应的英文页面有后续更新,如需浏览最新文档可切换至英文页面浏览。

Animation Montage Overview

An Animation Montage (or Montage for short) provides a way for you to control an animation asset directly through Blueprints or through C++ code. With an Animation Montage, you can combine several different 动画序列 into a single asset that you can break up into Sections and can selectively play back any or all of the sections. You can also fire off Events within the Montage and they also provide a way to replicate 根运动 across networked games if your animation has Root Motion enabled.

Example Montage

To demonstrate a practical usage case for Montages, take for example the Animation Sequence below of a character reloading a shotgun.

In the video above, the character reaches for a clip, reloads and then returns to an idle pose. While this is perfectly fine to use as a reload animation, a Montage will provide much more control. For example, suppose you wanted the character to reload a variable amount of bullets instead always the same amount. By splitting this animation up into three parts: grabbing a clip, reloading and returning to idle and combining them inside a Montage, you could section them off and selectively play any or all of those sections.

Below is an example Montage used to handle the reloading of a shotgun and we've sectioned it off into three parts: Start, Loop, and End.

MontageExample.png

With Blueprint or C++, we can define that when the player presses a button, the animation is played and it begins at the Start section. The looping middle section called Loop, immediately follows the Start section and is set within the Montage to repeat indefinitely. If the player releases the reload button or they've filled the shotgun with bullets, the animation will stop looping and can be set to jump to the End section to transition out of the animation as seen in the video below.

The reload motion is a little bit faster than the baked sequence, however, we could adjust the play rate of our looping animation if desired as well but this gives us the ability to control when we want to break out of our reloading motion and return back to an idle pose. A similar usage example could be that a character jumps in the air, loops an animation of being in the air or falling, then plays a landing sequence. The amount of time in the air could be a variable that we want to break out of at any point which we could do with a Montage.

Some additional uses for Montages include:

  • The ability to play an animation from within the Event Graph of an Animation Blueprint.

  • Chaining together a complex sequence of animations that you want to think of as a single animation.

  • Looping only a specific portion of animation (or animations) based on code, or a Blueprint script.

  • Handling event-based switching of multiple animations based on code, or a Blueprint script.

  • The ability to assign complex animation sequences to named slots that can be switched between in code, or with Blueprints.

  • Precise switching between various AnimSequences based on code, or with a Blueprint script.

Montage UI

After creating a MontageNEW! and opening it inside the 动画模式 , you can use the Asset Editor section to define how your Montage functions.

MontageWindow.png

The Asset Editor panel of a Montage is broken up into the following primary areas:

  1. Montage

  2. Sections

  3. Element Timing

  4. Notifies

  5. Curves

Montage

The Montage area breaks down as follows:

MontageArea.png

  1. Sections - Shows any Sections that have been created within the Montage.

  2. Slot - Shows the animations that have been added to the current Slot.

  3. Group/Slot - Shows the currently selected Anim Group and Slot.

Sections

Creating Sections provides a way to break a Slot into multiple portions of animation. Each Section has a name and location in the Slot's timeline. Using the name, you can either jump directly to a particular Section or queue it up to play next when the current section is complete. In Blueprint, you can query the current Section, jump to a Section, or set the next Section that will play.

Another way to think of Sections is like songs in a music playlist with Slots being the album. You may be currently playing a section (song) but you can queue up or jump to another section within the slot (album) when the current section finishes or just jump to the one you want to play right now.

Slot

Within a Montage, a Slot is just a single track that can hold any number of animations. You can pick any name for a Slot and then use that name to blend to the animations within. Going back to the reload Montage example, we could have different versions of the reload for when the player is standing versus when they are prone. In this case, we could place animations for each within separate Slots in our Montage (below) and use the Slot node in the AnimGraph of our Animation Blueprint to determine which set of animations to use based on whether the character is standing or prone.

MultipleSlots.png

Above we use the DefaultProne slot for when our character is standing and reloading and the Prone slot for when our character is reloading while prone.

When multiple Slots are assigned, you can click the PreviewButton.png preview button for the Slot you want to preview in the editor.

For the best results when using multiple Slots, try to ensure that the timing of animations involved from end-to-end is the same length.

Groups / Slots

Groups are a collection of Slots and you can only play a single Montage per group. If you want to play another Montage at the same time, you can create a new Group for it. Anim Groups and Slots are centralized within the Anim Slot Manager tab which you can open by clicking the AnimSlotManagerButton.png icon and you can use the drop-down menu to select between valid slots. When creating a new Montage, Slot nodes start out with a single Default Slot so that they are immediately functional.

Sections

The Sections area is where you can establish relationships between the Sections you define in the Montage area.

SectionsUI.png

  1. Create Default / Clear - Create Default creates the default associations between all Sections, stringing them together one after another while Clear wipes out all associations.

  2. Section Buttons - In this area, you will see a button for each of the Sections you define in the Montage area that you can assign for Section Association.

  3. Section Association Tracks - Here you can visualize the relationships between animation Sections by clicking Preview All Sections or individual tracks by clicking Preview.

Looping

Sections can be set up to loop indefinitely, which is extremely useful for any action that you need to repeat. By associating the same Section more than once in a Section Association Track, you cause that association to run in a loop. The section will turn blue to show this. As an example, consider the animation in which a character is reloading a shotgun, one shell at a time. You could take just the section in which the character inserts a shell, and loop it. Then, by using Notifies, you could create Notify Events in Blueprint that increment the ammo count each time the animation plays through. Once that count reaches a set number (full ammo), you could then switch to an animation of the character closing the receiver and returning to idle.

Element Timing

The Element Timing track takes information from the Montage and Notifies areas to help with the timing of different sections.

ElementTimingTrack.png

Each node in the track is given a number denoting the trigger order of that object within the Montage and is color coded:

  • Red - This denotes Notifies, Notify States and Notify State ending markers.

  • Light Blue - This denotes Branching Points.

  • Green - This denotes a Montage Section.

Clicking the ElementOptions.png button on the Element Timing track presents you with options for showing/hiding additional information.

Notifies

NotifiesSection.png

Animation Notifies (or Notifies for short) are a way to set up events to occur at specific points in the animation. For example, in the image above, we have placed Notifies to play sounds in our Reload Montage for grabbing a clip and each time the reload animation plays. We also call a custom event called SpawnClip that we can use to spawn a mesh in the world representing an ammo clip. Finally, we use a Branch event during the looping portion to determine if we should exit the loop and move on to the End section of our animation where the character returns to an idle.

Curves

CurvesArea.png

动画曲线 provide a way to change the value of a Material parameter or a Morph Target while an animation is playing back. Their workflow requires that you designate the asset you want to modify (either a Material or a Morph Target), name the curve accordingly, and then adjust keyframe values across the duration of an animation.

Playing Montages

Montage assets can be played in a few different ways based on your needs. If you want a Skeletal Mesh to just play the Montage automatically, you can assign it as the Anim to Play for the Skeletal Mesh. If however you only want your Montage to play when specific criteria are met, you may want to create Blueprint script that calls for the Montage or Sections within the Montage to play using the Play Montage node. You can also tell Montages to play through C++ code based on your defined criteria.

See the 使用动画蒙太奇NEW! page for more information.

Child Montages

Child Montages provide a convenient way to create animation variants without affecting gameplay, and without needing to recreate and maintain Notifies (or other details) across multiple assets. An example use case for this might be varying the auto-attack animations on units in a real-time strategy (RTS) game, or changing a character's idle animation in a role-playing game (RPG), or an action game, based on what kind of weapons or armor they are holding or wearing. A Child Animation Montage can be created from an existing Animation Montage via the Create Child Montage context-menu option when right-clicking on an Animation Montage in the Content Browser.

ChildMontageOption.png

The new montage will have the same name as the original, but with "_Child" added to the end.

NewChildMontage.png

When opening a Child Montage, all elements within the Montage will be grayed out and text will appear at the top indicating that it is a child.

GrayedOut.png

The Anim Segment in the Slot Track can be right-clicked and overridden with a new animation.

RightClickChange.png

In the Slot Track it is possible to substitute any animation for any other, even if they are of different lengths. The engine will automatically adjust the play rate, start time, and end time, of the replacement animation so that it uses the equivalent portion and runs at the same time as the original. Animations that have not been changed from the parent will be shown in green and animations that have been overridden will be shown in yellow.

ReplacedMontage.png

Above we have replaced our attack animation with a different attack animation.

Child Montages cannot be used as parents for other Child Montages.