当前位置:网站首页>Unity metaverse (II), mixamo & animator hybrid tree and animation fusion
Unity metaverse (II), mixamo & animator hybrid tree and animation fusion
2022-07-25 21:29:00 【Hua Weiyun】
Mixamo
brief introduction
MixamoyesAdobeThe company launched online freeCharacter animation library, Address :https://www.mixamo.com/#/, We can search for the character animation needed for development and download it .

Instructions
For example, we want to Avatar Add a role Idle Animation , stay Search Search in the search bar :

Can pass UPLOAD CHARACTER Upload our own Avatar Model to preview the animation effect :

Click on DOWNLOAD You can download the corresponding character animation , After downloading to Unity in , stay Import Settings Import settings Rig Window , take Animation Type That is, the animation type is changed to Humanoid Human animation :

Unity Animator
Blend Tree Mixed tree
Blend TreeyesAnimator ControllerA special state type in animation state machine , Used between multiple animationsSmooth blend, The influence of each animation on the final effect is determined byMixing parameterscontrol , It is often used to deal with the blending between mobile animations .
For example, we are in Mixamo The animation library is downloaded Idle、Walk、Sprint, That is, static 、 walk 、 Run three animations , Next, I want to use Blend Tree Through a parameter Speed That is to control the mixing between the three animations by moving speed .
First of all, these three animated Loop Time Set to true, It means that they are Loop Playback Of :

stay Animator Pass through Right click > Create State > From New Blend Tree To create a hybrid tree , Name it Move, And create parameters Speed:

Double click to enter the hybrid tree , Add three stills 、 walk 、 Run three animations , Because we use a parameter Speed To control mixing , therefore Blend Type Use default 1D The way ,Threshold The thresholds are set to 0、10、25:

Set through the value entered by the user Speed Parameters :
using UnityEngine;namespace SK.Framework.Avatar{ /// <summary> /// Avatar Animation control /// </summary> public class AvatarAnimatorController : AvatarMovementController { // Animation parameters private static class AnimatorParameters { public readonly static int Speed = Animator.StringToHash("Speed"); } private Animator animator; protected override void Start() { base.Start(); animator = GetComponent<Animator>(); } protected override void Update() { base.Update(); animator.SetFloat(AnimatorParameters.Speed, Mathf.Clamp01(input.magnitude) * speed); } }}
Animation fusion
Animation fusion refers to the fusion playback between two animations , For example, in the third person shooting game, players shoot while walking , It can be understood as moving + Fusion playback of shooting animation :

Here we walk + Take the animation fusion of greeting as an example , We are Mixamo Download one from the animation library Wave Animation , stay Animator Create a new Layer Hierarchy , take Weight The weight is set to 1,Blending Set to Override The way , And create a Avatar Mask:

Avatar Mask Disable other parts except the right hand and right arm , Because we only need our right hand and right arm to greet :

Add one Trigger Parameters of type , Used to trigger Wave action :

Suppose the user presses Shortcut key 1 Trigger when Wave action :
using UnityEngine;namespace SK.Framework.Avatar{ /// <summary> /// Avatar Animation control /// </summary> public class AvatarAnimatorController : AvatarMovementController { // Animation parameters private static class AnimatorParameters { public readonly static int Speed = Animator.StringToHash("Speed"); public readonly static int Wave = Animator.StringToHash("Wave"); } private Animator animator; protected override void Start() { base.Start(); animator = GetComponent<Animator>(); } protected override void Update() { base.Update(); animator.SetFloat(AnimatorParameters.Speed, Mathf.Clamp01(input.magnitude) * speed); if (Input.GetKeyDown(KeyCode.Alpha1)) { animator.SetTrigger(AnimatorParameters.Wave); } } }}
边栏推荐
- An interview question combining defer and function in golang
- H5 realize the animation effect of a scratch card
- 零基础学习CANoe Panel(17)—— Panel CAPL Function
- 【面试:并发篇24:多线程:综合练习】顺序控制
- Fastjson deserialization vulnerability utilization analysis collection
- Kali modify the update source (it is not safe to update with this source)
- QT | learn about QT creator by creating a simple project
- sqlx库使用
- Decompile app
- Job interviews are always a second kill? After reading the seckill system notes secretly stored by JD T8, I have given my knees
猜你喜欢

Sum of two numbers and three numbers

C#Socket

Byte side: can TCP and UDP use the same port?

When facing complex problems, systematic thinking helps you understand the essence of the problem

函数栈帧的创建和销毁
![[manageengine]itsm application in retail industry](/img/25/e8d9a320c5d4b1cf2e187b61180991.png)
[manageengine]itsm application in retail industry

腾讯云数据库的可信可控之路

Stm3 (cubeide) lighting experiment

Interface testing tool restlet client

Cesium 多边形渐变色纹理(Canvas)
随机推荐
Autojs learning - file depth search
pyqt5使用pyqtgraph绘制多个Y值散点图
Add startup software items when the win system starts up
Achieve accurate positioning based on Tencent map, and realize the attendance punch function of wechat applet
day04_ array
NPM module removal_ [solved] after NPM uninstalls the module, the module is not removed from package.json [easy to understand]
【C语言入门】ZZULIOJ 1016-1020
How to automatically generate short chains? How to generate links with UTM parameters online in batches?
resize函数的作用「建议收藏」
What's special about Huawei's innovative solutions to consolidate the foundation of ERP for small and medium-sized enterprises?
C#Socket
Temperature and humidity environment monitoring system based on stm32
Fastjson deserialization vulnerability utilization analysis collection
牛客-TOP101-BM37
The role of the resize function is "suggestions collection"
Programmer's Guide to health quenching 5: introduction to sports Basics
In depth understanding of seven specific ways to enhance code scalability
An interview question about concurrent reading and writing of map in golang
Apache Shenyu admin authentication bypass vulnerability (cve-2021-37580) analysis and protection measures
[depth] the new LAAS agreement elephant: the key to revitalizing the development of the defi track