当前位置:网站首页>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); } } }}
边栏推荐
- 腾讯云数据库的可信可控之路
- Database SQL statement exercise "suggestions collection"
- Airtest solves the problem that a password needs to be entered in the process of "automatic packaging" (the same applies to random bullet frame processing)
- How to automatically generate short chains? How to generate links with UTM parameters online in batches?
- 【面试:并发篇25:多线程:volatile】可见性
- Add startup software items when the win system starts up
- Airtest解决“自动装包”过程中需要输入密码的问题(同适用于随机弹框处理)
- MPI learning notes (II): two implementation methods of matrix multiplication
- ES6---4个强大运算符(??、??=、?.、?:)
- Talk about what's going on with C # backstage GC?
猜你喜欢

DDD的Go实战

2022 latest examination questions and answers of eight members (standard staff) of Shanghai Architecture

strcpy()

How to choose sentinel vs. hystrix current limiting?

The international summit osdi included Taobao system papers for the first time, and end cloud collaborative intelligence was recommended by the keynote speech of the conference

Vivo official website app full model UI adaptation scheme

字节一面:TCP 和 UDP 可以使用同一个端口吗?

Achieve accurate positioning based on Tencent map, and realize the attendance punch function of wechat applet

Oracle RAC RMAN backup error ora-19501 ora-15081

As a test, how to understand thread synchronization and asynchrony
随机推荐
ES6---4个强大运算符(??、??=、?.、?:)
H5 realize the animation effect of a scratch card
Blood spitting finishing nanny level series tutorial - playing Fiddler bag capturing tutorial (7) - Fiddler status panel -quickexec command line
An interview question about recover in golang
My heart's broken! After being cheated by 30000, a 16-year-old girl was unconvinced and cheated by 50000
C#常见的集合
Six principles of C program design
sqlx库使用
一道golang中defer和函数结合的面试题
工作面试总遇秒杀? 看了京东 T8 大咖私藏的秒杀系统笔记, 已献出膝盖
When MySQL imports data, it has been changed to CSV utf8 file and the file name is English. Why does it still fail to import
黑盒(功能)测试基本方法
数据库sql语句练习题「建议收藏」
Naming rules for BSP of Quanzhi chip
[FAQ] access the HMS core push service, and the server sends messages. Cause analysis and solutions of common error codes
人脸与关键点检测:YOLO5Face实战
NPM module removal_ [solved] after NPM uninstalls the module, the module is not removed from package.json [easy to understand]
Cesium polygon gradient texture (canvas)
MPI学习笔记(二):矩阵相乘的两种实现方法
Autojs learning - Automatic screenshot of the king