当前位置:网站首页>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); } } }}
边栏推荐
- Niuke-top101-bm37
- 大厂面试官:千万级数据量的表,如何进行快速查询?
- JMeter distributed pressure measurement
- strcpy()
- Please give an example of how to optimize MySQL index (sqlserver index optimization)
- 有哪些优化mysql索引的方式请举例(sqlserver索引优化)
- Vivo official website app full model UI adaptation scheme
- Canvas fill gradient
- Interviewer of large factory: how to quickly query a table with tens of millions of data?
- 黑盒(功能)测试基本方法
猜你喜欢

Interface testing tool restlet client

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)

ONEFLOW V0.8.0 officially released

Debugged PEB (beingdebugged, ntglobalflag)

Basic method of black box (function) test
What's special about Huawei's innovative solutions to consolidate the foundation of ERP for small and medium-sized enterprises?

Pyqt5 use pyqtgraph to draw multiple y-value scatter plots

LeetCode刷题——猜数字大小II#375#Medium

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

【网络教程】IPtables官方教程--学习笔记2
随机推荐
Autojs learning - file depth search
Detailed explanation of Ag search tool parameters
GDB locates the main address of the program after strip
Leetcode skimming -- guess the size of numbers II 375 medium
Record the transfer of domain names from Alibaba cloud service providers to Huawei cloud
【网络教程】IPtables官方教程--学习笔记2
如何自动生成短链?如何在线批量生成带UTM参数的链接?
ES6---4个强大运算符(??、??=、?.、?:)
resize函数的作用「建议收藏」
牛客-TOP101-BM37
一道golang中关于接口和实现的面试题
How to copy all files in one folder to another folder
我也是醉了,Eureka 延迟注册还有这个坑!
一道golang中关于map的并发读写的面试题
作为测试,如何理解线程同步异步
On Web Performance Optimization (1)
An interview question about concurrent reading and writing of map in golang
Vivo official website app full model UI adaptation scheme
cuda_ error_ out_ of_ Memory (out of memory)
接口测试工具 restlet client