字幕列表 影片播放 列印英文字幕 Sometimes when animating you want a mix of two or more animations. For example if you have animations for running left, running forward and running right you might want animations for running only slightly to the left or right. Another common example is having walking and running animations but wanting the character to be able to move at different speeds between the two. Blend trees can be used to achieve this. To create a blend tree right-click on empty space in the animator window. Choose Create State - From New Blend Tree. This creates a state that has a blend tree as it's motion instead of a single animation. Double clicking on the state allows you to edit the blend tree. The breadcrumb in the upper left hand corner shows us that we are working in our blend tree. Clicking the base layer name will bring us back out of the blend tree. With the blend tree selected we can see it's properties in the Inspector. The first thing to note is that blend tree's have names. These can be different from the state that holds them. Next comes the blend type. For now we will be concentrating on one dimensional blend trees. We will be coming back to the different types of 2 dimensional blend trees later. One dimensional blend trees use a single parameter to control how much of each of it's motions should be played. In the example given earlier of running left or right the blend tree's parameter might be something like direction or angular speed. Or for the walking/running example the parameter could be speed. Next is the list of motions. To add motions click the + icon. This gives you the options of Ad Motion Field, and New Blend Tree. Selecting New Blend Tree allows you to have nested blend trees so you can blend animations based on more than one parameter. However, if you wish to do this an easier approach is usually to use 2 dimensional blend trees. As such we'll be dealing with just adding motion fields. Each motion field represents an animation. These can be dragged on from the Assets in the Project panel or selected from a list by using the circle select button. Each motion field then has 3 properties. The threshold is the value of the parameter you have selected that represents a blend using entirely this animation. For example, let's say you have a walking and running animation and their thresholds are 5 and 10 respectively. If the Speed parameter is set to 10 then the blend tree will play just the running animation. If it's set to 7.5 it will play a 50/50 blend of walking and running. The next property is the Time Scale. This affects the speed the animation is played at just the same as the speed property for normal states. The last property decides whether or not the animation is mirrored left to right. After adding motion fields you'll notice that a blue cross pattern diagram appears above the list of motions. This is an illustration of where the different motions lay on the scale of the parameter. The lowest threshold on the left, the highest on the right. You can use the red scrubber to preview the blended animation for various values. If you wish to change the order of the motions on a blend tree for any reason you can drag the motions around using the handle on the left of the motion property. Below the list of motions are a few properties that help adjust the attributes of your motions. Generally it's a good idea to use these options once you have added all of the motion fields you need and given them animations. If Automate Thresholds is checked then the thresholds you have for each animation will be set and won't be changeable. If it is unchecked then we can use the following 2 options. Compute Thresholds will calculate and set values for the thresholds of each of your motion fields. It will do this based on a property of root motion, which you select. These properties are Speed, Velocity X, Velocity Y, Velocity Z and Angular Speed in either radians or degrees. Since blend trees often have their thresholds based on these root motion properties these are also common examples of animator parameters. Using Adjust Time Scale you can make the speed for each animation homogenous. This means that each of the animations will result in the same speed of root motion. 2 dimensional blend trees work in a very similar way to 1 dimensional blend trees but blend according to 2 parameters instead of 1. There are 3 types of 2D blend trees. The first 2 are for blending based on direction. They are 2D Simple Directional and 2D Freeform Directional. The last type is 2D Freeform Cartesian and it is used for situations where the parameters do not represent direction. 2D Simple Directional is used for when you want to blend movement based on directional parameters and have single animations on each direction, such as walk forward, walk back, walk left, etcetera. 2D Freeform Directional is used similarly but can include multiple animations in the same direction. For example walk forward and run forward. 2D Freeform Cartesian is used when the parameters are not based on direction, for example speed and angular speed. Creating each of these types of blend trees works the same. Once you have chosen a type choose an animator parameter to represent the X axis and one to represent the Y axis. For the directional types a standard X axis parameter might be velocity X. And a standard Y axis parameter might be velocity Z. For Freeform Cartesian this choice is more open. Once you have chosen your parameters the next step is to add motions. Just as with 2D blend trees these can be either blend trees or motion fields. However unlike 1D blend trees the order in which they are added doesn't matter. Once you have added motions you will see a diagram of where the motions are according to their thresholds. This again works the same as 1D blend trees, but since it is based on 2 thresholds, an X threshold and a Y threshold the diagram is in 2 dimensions. Each of the motions can be positioned manually by dragging them on the diagram positioned by setting the thresholds manually or by using the Computer Positions option. This works the same as the Compute Thresholds option for 1D blend trees but computes the threshold based on both parameters. 1 dimensional blend trees use a red scrubber to preview the motion. For 2D blend trees there is a red dot that can be dragged around.
B1 中級 英國腔 融合樹 - Unity官方教程 (Blend Trees - Unity Official Tutorials) 24 4 朱瑛 發佈於 2021 年 01 月 14 日 更多分享 分享 收藏 回報 影片單字