Skip to main content
AR论坛
 首页 » 资源教程 » UE4教程

ue4官方文档下载及翻译

2016年12月01日 23:10:041370u012999985

最近学习UE4的使用,发现这篇官方文档没有中文翻译,就想着翻译一下给大家参考参考吧。由于水平有限,里面一些翻译掺杂了我个人的理解,如果有任何问题欢迎提出,我会及时修改的~(时间有限,每天只能翻译一部分)

https://docs.unrealengine.com/latest/CHN/Engine/Animation/AnimMontage/index.html(官方文档链接)

AnimMontage(动画剪辑)

Pe:

Overview(综述)

AnimMontages (or just Montages for short) are a multipurpose tool that allows for a wide variety of animation effects, primarily related to exposing animation controls within code or Blueprint. It can also be used to create a wide variety of animation effects including intelligent loops of animation, logic-based animation switching, root motion handling, and much more.

动画剪辑(简称Montage)是一种通用的工具,他可以将多种动画效果(Animation)展示给那些用代码或者蓝图所实现的动画控制器。他也可以被用来创建诸如动画的智能循环,基于逻辑的动画转换,根节点运动处理等等各种各样的动画(Animation)。

AnimMontages are animation assets that can be created and exist within the Content Browser. These assets can then be plugged directly into the AnimGraph in run-time and you can modify any state of it. For example, you can jump to different sections or you can re-link different sections. This is mostly for code driven animations or one-off animations such as melee attacks, allowing you to control triggers, stop when you want, or change state (looping or non-looping) between (see the image below).

动画剪辑是一个动画集合,可以在内容浏览器被创建并保存。这些集合可以实时的直接插入到*动画编辑图(AnimGraph )中并且你可以任意的修改他的状态。例如,你可以切换不同的动画部分并且重新链接他们。动画剪辑大部分都应用于代码控制的动画或者一次性的动画。例如,格斗攻击,需要你来控制触发器,按照你的意愿随时停止,或者改变状态(是否循环)。(参考下面的图片)

 ue4官方文档下载及翻译 UE4教程 第1张

The image above is a melee attack with 3 sections [start, loop, and end]. When the player left-clicks, it triggers the start section by default when you ask to play the montage. Now the middle section is set to loop. When the start is done, it will transition to loop, and will loop there forever. If the player lets the mouse button go, it will stop, but you do not want to stop right away since the animation will pop in the middle of the loop. You would like to relink the loop to the end, where it will then transition out to the end and finish the animation.

上面的图片是一个拥有三部分的攻击动画【开始,循环,结束】。当玩家点击鼠标左键时,就会在你调用动画剪辑的时候默认触发开始的动画部分。现在我们看到中间部分是设置为循环的。当开始动画播放结束后,就会过度到中间的循环部分并一直循环下去。如果玩家释放了鼠标左键,循环就会停止。但是你应该不想让动画在播放到一般的时候就突然中断。你可能更想让循环部分播放后再链接到结束动画部分,这样就可以让中间部分渐渐的淡入结尾部分并完成整套动作的播放。(注:这样看起来效果更好)

Some additional uses for Montages include:

  • The ability to play an animation from within an AnimBlueprint's EventGraph.

  • 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 Blueprint script.

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

  • Proper handling of Root Motion for your characters.

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

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

一些针对动画剪辑的其他用法:

  • 可以使用蓝图的事件图(EventGraph)来控制播放动画

  • 把多个不同的动画序列链接成一个单独的动画

  • 通过蓝图或代码,局部的循环播放一个或多个动画的特定部分

  • 通过蓝图或代码,处理基于事件的多种复杂动画的切换

  • 恰当的处理“操作对象”的根节点动作

  • 把复杂的动画序列分配给不同的被命名的插槽(注:理解为序列中的任意位置都可以定义一个插槽)

  • 通过蓝图或代码,精确的把不同的动画序列连接到一起

So, as you can see, there are a lot of different things you can do with Montages. This can easily make Montages seem overwhelming as a system. However, if you really boil it down, the key point of Montages is to expose animation controls to code or Blueprints. Nearly everything else the system can do follows from that single point.

An example of an Animation Montage applied to a character can also be seen on the Animation Content Examples page under section 1.5.

 所以,我们就会发现,在动画剪辑中我们可以自由的去做很多事情。这使动画剪辑理所当然的成为一个出色的系统。当然,如果非要去总结一下的话,动画剪辑系统就是把所有的动画展示给我们的代码和蓝图,从而让我们能自由的控制。就凭这一点,我们几乎就可以做出一切我们想要的效果。

     想尝试动画剪辑如何运用到角色身上的话也可以参考例子Animation Content Examples 的1.5章节。

System Caveats(系统说明)

There are a few details to keep in mind regarding AnimMontages:

  • Only one Montage can play back at a time. If you start playing a second one, it will stop the first.

  • At this time, root motion is replicated across the server. However the AnimMontage is not. That means that users utilizing root motion will need to make sure they are replicating the state of the AnimMontage across the network. (Position, play rate, etc.).

关于动画剪辑系统有几点需要说明一下:

  • 同一时刻只能播放一个Montage (注:为了叙述简洁,后面一些地方直接使用英文)动画。如果你开启了另一个Montage动画,第一个就会停止。

  • 动画播放的一刻,根节点的动作将会被复制到服务器上,但是动画剪辑的内容不会被复制。这也就是说,用户执行根节点动作时需要确保动画剪辑的状态通过网络传输到服务器或者其他玩家客户端(如坐标,玩家状态等)。(注:如果客户端服务器状态不统一,会导致二者计算结果不同,游戏的效果也就不同)

Montage Properties(动画剪辑的特性)

The following is a breakdown of the AnimMontage asset properties. These are available in Persona when looking at a Montage, and can also be accessed by right-clicking on a Montage within the Content Browser and choosing Properties from the context menu.

下面图片是动画剪辑自身属性的分类展示。这些属性可以在打开角色视图(包括骨骼,Mesh,动作等文件)的动画剪辑中看到,当然你也可以在文件浏览器中通过右击一个动画剪辑文件并选择属性菜单来查看。

ue4官方文档下载及翻译 UE4教程 第2张

 


Montage Properties(动画剪辑属性)

Montage

Blend In Time

混合切入时间

This is an amount of time at the beginning of Montage playback during which the character will blend in from its current pose.

这是在Montage动画开始播放时,从当前动作姿态过度到新动作所消耗的时间。(注:该时间为0,则没有过度;时间越大,新动作越不明显,当超过一定值时,几乎没有变化)

Blend Out Time

混合切出时间

This is an amount of time at the end of Montage playback during which the character will blend back to its original pose.

这是在Montage动画结束播放前,动作切换到原始状态所消耗的时间。

Root Motion(根节点动作)

Enable Root Motion Translation

可以编辑根节点位移变换

Enables handling of root motion translation, cancelling out any translation applied to the root so that it can then be applied back to the character's collision capsule. Please see 根骨骼运动 for more details.

(勾选的话)可以编辑处理根节点的动作(位移)变换,(不勾选)取消任何对根节点的位移操作。这样就可以决定是否使人物使用角色本身的碰撞胶囊。想查看更多细节请参考根骨骼运动。

Enable Root Motion Rotation

可以编辑根节点的旋转变换

Enables handling of root motion rotation, cancelling out any rotation applied to the root so that it can then be applied back to the character's collision capsule. Please see 根骨骼运动 for more details.

(勾选的话)可以编辑处理根节点的动作(角度)变换,(不勾选)取消任何对根节点的旋转操作。这样就可以决定是否使人物使用角色本身的碰撞胶囊。想查看更多细节请参考根骨骼运动。

Additive Settings(附加设置)

Preview Base Pose

预览基本动作

Sets a base preview pose used for additive Blend Spaces.

为附加的动作混合窗口设置一个基本动作的预览。(注:其实就是你这个Montage的一个动画预览,默认的为空显示的就是你编辑后的结果,所以一般不用设置)

Animation(动画)

Rate Scale

比率

A multiplier value for how fast the Montage will play back. Default is 1.0.

一个因数值来表示Montage动画播放的速率,默认为1。

Skeleton

骨骼

Contains the skeleton associated with this Montage. Cannot be changed in the editor

.包含了和Montage动画相关的骨骼。在编辑器里面不能修改

Montage UI(动画剪辑系统UI)

When looking at a Montage in Persona, it is useful to know what each area is and what it does:

当我们在角色窗口查看动画剪辑系统时,很有必要去知道每一块区域是做什么的:

ue4官方文档下载及翻译 UE4教程 第3张

 

  1. Montage Area

  2. Sections Area

  3. Notifies Area

  4. Curves Area

Montage Area

The Montage Area breaks down like so:

ue4官方文档下载及翻译 UE4教程 第4张

 

  1. Section Track - Shows any Sections that have been defined for this Montage. Sections can be dragged to different positions along the timeline with the left mouse button.

  2. Slot Track - Shows the current Slot, along with the Slot name on the right. This Slot may be filled with as many animations as you desire; they will be played back in order. Notice that multiple animations will have alternating positions in the Slot Track - top, then bottom, then top again, and so on. This is to help you differentiate between different animations.

  3. Branch Point Track - Shows any Branch Points that have been defined for this Montage. Branch Points can be dragged to different positions along the timeline with the left mouse button.

You may have as many Slot Tracks as you like within a single Montage, each with their own name and containing their own unique animations. However, you may only have one Section Track and one Branch Point track for each Montage.

Sections

Montage Sections provide a way to break a Slot up 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 to play next, when the current segment is complete. In Blueprint, you can query the current Section, jump to a Section, or set the next Section that will play.

It may help to think of Sections like songs on a music playlist, with Slots being the albums. Just like with many modern media players, you can choose which song will play next when the current one finishes, or just jump to the one you want to hear right now.

Sections are created by right-clicking on the Section track and choosing New Montage Section.

Slots

Within a Montage, a Slot is just a single track that can hold any number of animations. You can name this Slot, and then blend to those specific animations by calling the Slot name. A great example is having a character with a weapon reload animation. You may have different versions of the reload for when the player is standing, crouching, and lying prone. So long as all 3 of the animations used the same timing, you could place each one within a separate Slot in your Montage; the Slots could be named Standing, Crouching, and Prone. In your Animation Blueprint's AnimGraph, you can use the Slot node to determine which one you want to play based on your character's current state. When they are standing, you can use the result of the animation in the Standing Slot. When they are prone, you can see the result of the ProneSlot.

It is an important point to keep in mind that although much of your Montage control will take place in the Animation Blueprint's Event Graph, Slots are actually handled within the Anim Graph. This is done by way of the Slot node, which simply takes in the name for a Slot. By positioning this node at a strategic point along your AnimGraph's execution, you can have multiple Montages that utilize the same Slot name.

Branch Points

Branch Points allow you to create events that coincide with animation playback. These Branch Point Events can be used in code or Blueprint to cause other things to happen, but specifically, Branch Points are useful for switching to other animation Sections within a Montage.

If you are already familiar with Animation Notifies, you may notice a strong similarity between the two systems, as they both expose events that can be leveraged in script. The key difference is that Notifies are asynchronous, while Branch Points are synchronous. What this means to the end user is that Branch Points come with a much higher degree of precision for where they will take place along the animation timeline.

High precision is important when you need to jump to a specific animation at a very precise moment in time. While you could use a Notify to do the same job, the asynchronous nature of Notifies means that the Notify Event could be fired at the incorrect animation frame, which can lead to hitches and jumps in your motion.

Due to their synchronous nature and the precision resulting from it, Branch Points are more performance expensive than Notifies. You should only use them when an event must be fired at a precise moment along the animation timeline, such as jumping directly to another animation that matches up frame-to-frame. If being off by a frame - or some percentage of one - is not important, you should use Notifies instead.

Sections Area

The Sections area is where you can establish relationships between the Sections you define in the Montage Area. For instance, you may want a certain Section of animation - or group of Sections - to play in a specific sequence, or even loop.

ue4官方文档下载及翻译 UE4教程 第5张

 

  1. Create Default and Clear Buttons - Create Default creates default associations between all Sections, stringing them together one after the other. 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. By choosing an existing Section and then clicking the one of these buttons, you associate the Section for that button with the selected track. For instance, in the image above, we have associated Swing2 with Swing1. The order actually goes Swing1, Swing2, and then Swing1 again, which causes a loop. See the Looping section below for details.

  3. Section Association Tracks - This is where you can visualize and preview the relationships between animation Sections. By clicking on the Preview buttons, you can see the result of each individual track, or click the Preview All Sections button and see all Sections play back one after the other.

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 an 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.

Notifies Area

ue4官方文档下载及翻译 UE4教程 第6张

 

动画通知(简称AnimNotifies或通知)使得动画相关的程序员可以设置在动画序列的特定点处发生的事件。通知通常用于这样的特效,比如走动时的脚步声、跑动动画或在动画中产生一个粒子特效。然而,它有很多种不同的用途,因为您可以使用自定义的通知类型来扩展该系统,从而满足任何类型游戏的需求。

For more information, see 动画通知 (通知).

Curves Area

ue4官方文档下载及翻译 UE4教程 第7张

 

曲线提供了在动画正在播放过程中改变材质参数或顶点变形目标的方法。 其工作流程非常简单,只需要您简单地指定您要修改的资源(一个材质或顶点变形目标),相应地命名该曲线,然后调整动画播放期间的关键帧的值。

For more information, see 动画曲线.

Montage Practical Example

In this example, we want to have a character that can freely run in all directions, with an attack animation that only plays on the upper body. This attack will have multiple animations that could take place during its course. This is a perfect way to show the assembly of a Montage, as well as how to control it in the Event Graph and blend into it within the AnimGraph.

However, there are few things we have set up in advance:

  • We already have a State Machine defining locomotion. This is just like the one used in the Third Person Project Template.

  • We have several animations provided by an artist that we would like to string together to make the Montage.

  • We have created a Character Blueprint Class that we can get input information from.

    • For this example: an IsAttacking Boolean that is set to TRUE when the Left Mouse Button is pressed and set to FALSE when it is released. 

      ue4官方文档下载及翻译 UE4教程 第8张

      请输入图片描述


      请输入图片描述


Creating the Montage

Making a Montage is as easy as right-clicking in the Content Browser and choosing Animation > Animation Montage. You can alsoright-click on an existing Animation Sequence and choose Create Montage from the context menu. This will automatically create a new Montage with the selected AnimSequence already set up in the default Slot.

ue4官方文档下载及翻译 UE4教程 第9张

 

Montage Setup

Our first order of business was to name our Slot. We only need one in this Montage, and since we want our attack to only affect the upper body, the name Upper Body seemed perfect. We then drag/dropped the animations we would need into this slot. The animations we have do the following:

  • Right-to-left hammer swing

  • Left-to-right hammer swing

  • Go from the end of the right-to-left swing back to Idle

  • Go from the end of the left-to-right swing back to Idle

The two swinging animations both end on the same pose as the other begins. This means that the two animations can play back to back in a loop and the character will seamlessly swing the hammer back and forth.

While order is not extremely important, having the first two animations at the beginning and back to back will simplify things later.

ue4官方文档下载及翻译 UE4教程 第10张

 

Section Creation

Our next step is to section out the animations in our Montage so that we can query them and call them up when needed in our Blueprint code. This is as easy as right-clicking and choosing Add New Montage Section while clicking on the Section Track at the top of the Montage Area.

We used fairly straightforward names for each Section. Note that we replaced the Default section that came along with the Montage (made a new one and deleted the Default by right-clicking and choosing Delete Montage Section). You can drag these Sections along the Section Track if you need to, and you will notice that they snap a bit at the boundary between two animation segments when you release the mouse. Use this to your advantage.

ue4官方文档下载及翻译 UE4教程 第11张

 

Defining Section Relationships

Now that our Sections are created, we can now define any special relationships between them using the Sections Area. For instance, we can define a relationship between the Swing1 and Swing2 sections so that they play back to back in a loop. This is very useful for us. We start by clicking the Clear button to wipe out any default relationships. Then it is just a matter of selecting the track with Swing1 in it, and clicking the green button labeled Swing2 near the top of the Sections Area. This will remove the Swing2 track and add Swing2 to the Swing1 track.

ue4官方文档下载及翻译 UE4教程 第12张

 

If we repeat the process, clicking the new Swing2 segment and then clicking the Swing1 button, the system detects that you are creating a loop and the track turns blue. This means that the Swing1 and Swing2 segments are considered a looping Section. They will play back to back, repeating indefinitely.

ue4官方文档下载及翻译 UE4教程 第13张

 

Setting Up Branch Points

We will now set up some Branch Points to test whether to continue with the loop or jump to one of two possible endings for our attack animation. All we have to do is right-click in the Branch Point Track and choose New Branch Point. We chose the names Swing_1_Endand Swing_2_End for our Branch Points. We also zoomed very closely in with the mouse wheel to make sure that each one fires right at the last possible moment of its corresponding section. This means it is placed very slightly to the left of the border between the two.

ue4官方文档下载及翻译 UE4教程 第14张

 

A similar system could be set up in which you use Notifies instead of Branch Points, but they would need to fire a little earlier along the timeline, and your Animation Blueprint Event Graph would be queuing the appropriate ending animation using the Montage Set Next Section node, rather than doing a direct switch with the Montage Jump to Section node, as we will be doing. Doing it with Notifies would be slightly cheaper on performance, as Notifies are asynchronous. Our example is academic, but we wanted to make sure to mention the other method, as well.

Setting Up the AnimGraph

At this point, our Montage is all set up. We now need to establish our AnimGraph so that it can read in the result of our Montage. This is a pretty simple process, but it does cause us to have to think carefully about how we proceed. Our AnimGraph starts off looking something like this, where we are only seeing the result of our State Machine:

ue4官方文档下载及翻译 UE4教程 第15张

 

We only want the Montage to play back from the Spine_01 bone (the waist) up, so we will be using a Layered Blend per Bone node. We add a Blend Pose to it set the weight to 1. We also associate this Blend Pose with Spine_01 in the properties for the node. We then bring in aSlot node and set it to UpperBody, the name of our slot. But now we run into a problem:

ue4官方文档下载及翻译 UE4教程 第16张

 

The Slot node needs a Source connection to fall back on once the Montage is done playing. Without it, the character will return to the T-pose from the waist up after the Montage completes. However, we cannot connect the State Machine to both the Base Pose of the Layered Blend per Bone as well as the Source for the Slot node. The solution? Use a Cache node! We can store the result of the State Machine into a Cache node, and then create Cached Pose nodes to connect to both our required inputs. This is somewhat similar to storing the result of the State Machine into a variable so you can use it in multiple places. For this example, we named the Cache LocoCache.

ue4官方文档下载及翻译 UE4教程 第17张

 

Our AnimGraph is done. As soon as the UpperBody Slot node receives data from any AnimMontage (you can use any Montage, so long as it has a Slot named UpperBody), it will blend it in. As soon as it is no longer receiving data, it will fall back on the result of the State Machine.

Setting Up the Event Graph

Our Event Graph setup is very basic. Using the Event Blueprint Update Animation node and dragging off the out pin of a Get Player Character node, we can Cast To our Character Blueprint (MyCharacter in this example) to access the variables and functions from that Blueprint (see Blueprint Communications for more info on communicating between Blueprints).

Click for full view

ue4官方文档下载及翻译 UE4教程 第18张

 

The first thing we do is check if the IsAttacking variable from our Character Blueprint is TRUE and if it is, we then check if the Montage is already playing. If the Montage is playing, we do not want to play it again; however if it is not playing, then we play the Montage. This prevents the system from restarting the animation in the middle of playback, which would look bad.

Dragging off the IsAttacking node which extends from the Cast To node, we see if the mouse button is still down, and if not, we jump to the appropriate ending animation, depending on which half of the loop is playing. Creating the Branch Point Events is done by right-clickingand choosing the appropriate event under Add Montage Branching Point Event.

ue4官方文档下载及翻译 UE4教程 第19张

 

And that is it! If we compile, we will now see that the character continues to swing as long as the mouse button is down, and performs an intelligent end animation when the mouse button is released!

ue4官方文档下载及翻译 UE4教程 第20张

评论列表暂无评论
发表评论