Unity animation--animation binding, conversion, triggered by script

How to make and add animation

Approximate Process Example Diagram

insert image description here

Convert multiple groups of pictures into animations and place them on objects

  • First, we need to add animator to our object

    [External link image transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the image and upload it directly (img-nLqiM2LY-1676419813764) (C:/Users/86188/AppData/Roaming/Typora/typora-user-images/ image-20230214142429934.png)]

    • Then we need to set the corresponding animation controller to control the playback order of the corresponding frames.
      insert image description here

​ [External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-T2KnsLFm-1676419813766)(C:/Users/86188/AppData/Roaming/Typora/typora-user-images /image-20230214143416552.png)]

Then we put the corresponding picture into the animation player.

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-VtVtpcXx-1676419813766)(C:/Users/86188/AppData/Roaming/Typora/typora-user-images/ image-20230215073343769.png)]

Ways to prevent looping

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-HZhmaYaM-1676419813766)(C:/Users/86188/AppData/Roaming/Typora/typora-user-images/ image-20230215075055457.png)]

Ok, now you have successfully put a set of pictures on the body of the object as an animation.

Next we should solve the problem of switching between animations.

Implement switching between animations

Through Animator, we can see the two sets of animations I made before.
(If you don’t have it, just do two groups, hee hee)

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-Fpfv6iXu-1676419813767)(C:/Users/86188/AppData/Roaming/Typora/typora-user-images/ image-20230215074649077.png)]

Among them, the orange one is the normal playback animation, which is always played by default.

Let's now complete the jump from normal to jump.

[External link image transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the image and upload it directly (img-FRSFPP8x-1676419813769) (C:/Users/86188/AppData/Roaming/Typora/typora-user-images/ image-20230215075451827.png)]

The right button is the connection. In fact, if the trigger mechanism is not needed, this is the end. The animation will switch between the two animations, and finally stop at the jump.

But this is not what we want, we need to use special conditions to trigger the switch.

Click on the upper left corner, we found that there are four trigger methods, we choose the fourth.

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-YJao8CWx-1676419813769)(C:/Users/86188/AppData/Roaming/Typora/typora-user-images/ image-20230215075935864.png)]

Then let the arrow bind him.

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-ZcBJZdM0-1676419813770)(C:/Users/86188/AppData/Roaming/Typora/typora-user-images/ image-20230215080104616.png)]

In this way, only when we make a jump click will it trigger

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-Io4SvXzM-1676419813770)(C:/Users/86188/AppData/Roaming/Typora/typora-user-images/ image-20230215080155632.png)]

We also don't want to perform a jump after clicking, and the object will not play animation, so we also need to make an arrow to switch from jump to normalization.

This time we don't need any trigger mechanism, but let him return to normal after jumping.

At this point, you only need to adjust the properties that come with the arrow.

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-5M2Of8am-1676419813771)(C:/Users/86188/AppData/Roaming/Typora/typora-user-images/ image-20230215080929514.png)]

Trigger Parameters(Trigger) using a script

Supongo que te gusta

Origin blog.csdn.net/abaidaye/article/details/129036525
Recomendado
Clasificación