About the use of the new animation system in Unity

Source: Internet
Author: User

Mecanim Animation

1: The Legacy animation system can only control the animation through the code to play, with the variety of animation, code complexity will increase, while the animation transition also requires very cumbersome code control, in order to let experienced animators develop animation, Unity launched a Mecanim animation system for the character;
2:mecanim supports motion redirection (retargeting), which applies animations from one role model to another;
3:mecanim allows the use of "muscle" to control the range of motion of different bones; When you think an animation is too exaggerated, you can use "muscle" to limit it.
4:mecanim Animation System three elements:
(1) Avatar: From the simplified human skeleton structure of the Mecanim system (skeleton Structure of unity Abstraction) to the actual skeleton structure provided by the user (the skeleton structure of their own model); This mapping is automatically recognized as long as we name the comparison specification.
(2) Animator Controller: Animation controllers are used to control the playback and transition conditions of animations
(3) Animation clip: Animated clip;

Mecanim Animated Instances

1. Create a Unity project and file directory

2. Import the resource file Package Body_anim.unitypackage (56th)

3. Open the Models folder, click Model Boy, set rig---->animation tyoe---->humanoid (humanoid animation)

4. Configure Avatar

A: After importing the model, configure the model's animation mode to humanoid mode.
None: Modeless, Legacy: Legacy animation mode, Generic other animation mode, humanoid humanoid character animation mode;
B: The system will automatically generate the model corresponding to the Avatar file, and as its sub-object, expand the model boy can see a boyavatar.
C: In most cases Mecanim can generate avatar files correctly,
Configure this front there will be a tick, click Configue, you can check to see
Map the situation, if there is an error, click Configue, manually do the mapping of the humanoid skeleton.

Clicking on the Configure,scene view will show the model, and the green one is the skeleton structure that unity abstracts out. The mapping on the right is the result of the mapping, no green fill is the art did not design this skeleton. There are red dots that are not mapped successfully and can be dragged in manually.

D:mapping:clear clear Mapping, automap automatic mapping;
E If the bones are bound correctly, but the character poses incorrectly (not the standard T-shape),
The message "Character not in T-pose" is visible in the scene to resolve this issue
You can t-pose or rotate other bones by Pose->enforce.
F:muscle configuration: For some overly exaggerated actions, such as animation redirection, the child's animation is used in adults, can be adjusted by the skeleton limits, so that the skeleton movement in this range, so that there is no need to re-create animation;
(1) Click Muscles & Settings Bar

(2) Click on the skeleton you want to limit;

(2) Adjust the parameters of the range of motion of the bone, the amplitude of rotational motion;

G. When the configuration is complete click Done---->apply

5. Drag the model boy into the scene and mount a animator component yourself

Controller Properties Drop Animation controllers

Boyavator file for Avator properties projection

6. Creating an animation controller under the Res folder create---->animator controller, called Anim_ctrl, double-click to open, you can press the middle mouse button to drag the background

7. Animation Controller Configuration

A: Animation controller Anim_ctrl Open: Parameters is the parameter list that the animation controller takes, layers is the current animation layer

B: Animation state machine
(1) The animation state machine must contain 3 animation state units Any, Exit, Entry;
(2) Animation state machine can contain multiple animation state units;
(3) can also include sub-animation state machine;
C: The creation of the animation State unit:

Before creating, you can see the effect of this animation, in the Assets\animations\anisforfight directory, click on one, and then click the Animation bar, the following play button can play.


    Method (1): The right mouse button in the animator window is selected in the menu when Create state-->empty; is first created, it is set to the default animation state and is displayed in yellow, entry points directly to it.

Creating one is not the default state, it is grayed out, or you can right-click on any non-default cell to set the default animation state, and only one default animation state.
Method (2): Drag the animation file into the animator window;

We create a default animation state unit called Idle, associated with its motion property, which is the idle file under Assets\animations\anisforfight\[email protected], which expands in the panel [email Protected] to see.

Then create an animation state unit called the jump, the motion property associated with it, the take 001 file under Assets\animations\anisforfight\[email Protected], which expands in the panel [email Protected] to see.

Test: Set the jump as the default animation state unit, associate the controller to the animator component, run it, and find that the model boy can play the animation.

D: Transition condition connection (transitions from one animation to another):
(1) Put the mouse on the state unit, right mouse button-->make Transition, create the animation transition conditions, and click on another state unit again, complete the transition condition connection;

(2) Click on the connection between two States, the right side is a transition effect, you can click Play, the following is a transition condition, the default is no transition conditions, we can add.

(3) on the left side of the state machine parameters panel, the parameters can be used to control the condition variables, first to create a parameter, click on the + number, select the int type, called Anim_state, the default value is 0

(4) After creating the parameters, then click the line between the two states, click on the conditions below the + sign, add a condition, is to anim_state as the condition variable, you can greater, less, Equals, not Equal------> Jump when you are 0

(5) Create a script to control the jump, called Anim_test

Open it

About the use of the new animation system in Unity

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.