Animation View editing of animation
The opening method of Animation editing: first, it can be completed by Ctrl+6; second, it can be created by Animation in Create in the right mouse button of the project Window; third, it can be created by Animation in Animation in the Window menu.
Secondly, Animation Event can be used in the Animation View. The requirements of the executable function of this Animation Event are: the modifier of the function must be public, the return value of the function must be void, and the function has only one input parameter. The types of input parameters can include int, string, float and object.
Animator Translation animation settings
Settings under Animation State:
LoopTime: loop playback of animation
Loop Pose: the pose of looping playback, which makes the looping playback of animation more natural
Cycle Offset: the offset of the animation cycle
Root Translation Rotation: does the rotation of the animation fit
Whether the play of the current animation will affect the position of the animated character itself
Base Upon: a reference point
Root Transform Position (y): whether the Y-axis of the animation fits, which is also a rotation of the animation and root animation on the y-axis
Root Transform Position (x, z): a fit on the X and Z axes of the animation, and a rotation on the X and Z axes of the root animation
Animator Controller window
Layers: layers of animation
Parameters: store condition parameters, which are used to switch the animation state
Weight: the weight of a layer. The higher the weight, the more obvious the animation in the layer
Mask: the place where the bones of animated characters are placed is also the avatar Mask
Blending: blending. There are two attributes, Override and Additive. The first is the partial limb coverage that can be animated with Avatar Mask, and the second is the certain integration of different animations
Sync: copy the animation of a layer
Timing: this option can only be turned on when Sync is turned on. At this time, the synchronization layer can obtain the control right of the synchronized layer
IK Pass: you need to click this button when using inverse dynamics
AnyState: any state can be switched to connected state if the conditions are met
State: single animation
Sub State Mechine: animation group
Blend Tree: animation Blend Tree
Can create condition parameters: float, int, bool, Trigger
Animator Controller component
Update Mode: the Update Mode of animation, including normal (call each frame with update in normal state), animate physical (update according to the animation in physical state, cooperate with FixUpdate), unscaled time (commonly used for UI component animation)
Culling Mode: used for scene optimization, including always animate, cull update transform and cull complete
AnimatorIK
Can only be used in OnAnimatorIK functions
Code example:
using System.Collections; using System.Collections.Generic; using UnityEngine; public class Test_IK : MonoBehaviour { public Transform look_obj;//Point of view public Transform left_Hand; public Transform right_Hand; public Transform left_Foot; public Transform right_Foot; private Animator my_Animator;//Animation controller public bool active=true; // Start is called before the first frame update void Start() { my_Animator = transform.GetComponent<Animator>(); } // Update is called once per frame void Update() { } private void OnAnimatorIK(int layerIndex) { if (my_Animator == null) { return; } if (active) { //Set the weight of each my_Animator.SetIKPositionWeight(AvatarIKGoal.LeftFoot, 1f); my_Animator.SetIKRotationWeight(AvatarIKGoal.LeftFoot, 1f); my_Animator.SetIKPositionWeight(AvatarIKGoal.LeftHand, 1f); my_Animator.SetIKRotationWeight(AvatarIKGoal.LeftHand, 1f); my_Animator.SetIKPositionWeight(AvatarIKGoal.RightFoot, 1f); my_Animator.SetIKRotationWeight(AvatarIKGoal.RightFoot, 1f); my_Animator.SetIKPositionWeight(AvatarIKGoal.RightHand, 1f); my_Animator.SetIKRotationWeight(AvatarIKGoal.RightHand, 1f); if (left_Foot != null) { my_Animator.SetIKPosition(AvatarIKGoal.LeftFoot, left_Foot.position); my_Animator.SetIKRotation(AvatarIKGoal.LeftFoot, left_Foot.rotation); } if (left_Hand != null) { my_Animator.SetIKPosition(AvatarIKGoal.LeftHand, left_Hand.position); my_Animator.SetIKRotation(AvatarIKGoal.LeftHand, left_Hand.rotation); } if (right_Foot != null) { my_Animator.SetIKPosition(AvatarIKGoal.RightFoot, right_Foot.position); my_Animator.SetIKRotation(AvatarIKGoal.RightFoot, right_Foot.rotation); } if (right_Hand != null) { my_Animator.SetIKPosition(AvatarIKGoal.RightHand, right_Hand.position); my_Animator.SetIKRotation(AvatarIKGoal.RightHand, right_Hand.rotation); } if (look_obj != null) { my_Animator.SetLookAtPosition(look_obj.position); my_Animator.SetLookAtWeight(1f, 1f, 1f, 1f); } } else { } } }