Unity Animation System-add animation to characters

Source: Internet
Author: User

Import the character model, the model is not moving, because no animation is added

First add the animator component to the model

Some models have their own components, because we set him up as a human animation, if it is normal animation to add their own. After adding the components, we found that a animator controller (animation controller) was missing, and we needed to add a drag in. Add an animated clip inside the controller. Click into the animator view to find the idle animation in the file and drag it in. The orange color is the default animation. Then drag into an attack animation atrrack, right key make Transition (create transition), at this time will find the animation automatically play, if we do not want to let the animation automatically transition, we need to add a condition to the transition, click on the Transition line, the tab has a transition condition

But now the transition condition is empty, so we have to create a transition condition ourselves, back to the parameters option on the left, we add a triggerr (trigger) condition to it and set it in conditions. Now attack is a one-time action, will not repeat, so this action will stop after playing, so we want to let Attackk back to idle state. Even back. We will find that when you click Trigger, you will not immediately jump from the idle state to the Atrrack state, which is because we have selected the default check has Exit time

If this button is checked, the animation will play the default playback of the next animation, if not checked, it will immediately play.

Use code to control the character attack trigger conditions. Add a C # script to the character.

Add a character run animation and code control (run animation), because running is a continuous action, when I hold the W, he should continue running, so we want to set a bool type of conditions. Run and stop are to be completed immediately, so should not be checked has exiit time. Code implementation


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.