Unity动画系统进阶

Unity动画系统进阶

##1、 动画层与遮罩效果数据库

++1.1、动画层编程

++++Unity中可使用动画层来管理不一样类型的动画分层处理。设计模式

++++打开层设置网络

--Weight :权重函数

--Mask :遮罩学习

--Blending :叠加或重写动画

--Sync :同步spa

--IK Pass :可以使用IK.net


++1.2、动画遮罩设计

++++动画层遮罩可以在本层动画中,身体的特定部分选择性的激活或禁用在Project面板下建立一个Avatar Mask

++++身体遮罩包括头部、左手臂、右手臂、左手、右手、左腿、右腿和根部,还能够选择给手和腿添加IK,这将决定IK曲线是否会包含在动画融合中,点击身体部分能够激活或禁用对应部分的动画。


++++动画遮罩

--根据骨骼节点,设置动画遮罩。

--设置完毕后,动画会按照遮罩效果播放。



##2IK动画

++2.1IK动画

++++Inverse Kinematics 反向运动

--1、大多数动画是由旋转关节角度的骨骼来预先肯定的值。子关节的位置变化根据父节点的旋转,所以关键链的最终位置会根据角度和它所包含的各个关节的相对位置来肯定。这种方法构成的骨架被称为正运动学。

--2IK动画全名是Inverse Kinematics意思是反向动力学,就是子骨骼节点带动父骨骼节点运动。好比跳街舞的少年用手撑着身体在地上转圈,手就是子骨骼,胳膊身体就是它的父骨骼,这时运动手就须要带动胳膊身体来移动。

++++反向运动学(IK

--IK动画须要使用Unity5新版的动画系统。

--要设置一个IK角色,你一般有周围的场景中一个与角色交互的物体对象,而后设置IK直通脚本,特别是动画功能,如:

  ---SetIKPositionWeight,

  ---SetIKPosition

++2.2、使用IK动画

++++设置IK

--咱们须要从一个正确配置的Avatar的人形Mecanim角色开始,接下来建立一个动画控制器,包含至少一个动画人物。

--而后在动画窗口的图层面板中,单击图层的齿轮设置图标,并在弹出的菜单中选中IK复选框。

++++注意:人型动画才能设置IK


++2.3、脚本控制

    animator.SetIKPositionWeight(AvatarIKGoal.RightHand,1);

    animator.SetIKRotationWeight(AvatarIKGoal.RightHand,1);

 

if(ikActive){

    animator.SetIKPosition(AvatarIkGoal.RightHand,rightHandObj.position);

    animator.SetIKRotation(AvatarIKGoal.RightHand,rightHandObj.rotation);

}else{

    animator.SetIKPositionWeight(AvatarIKGoal.RightHand,0);

    animator.SetIKRotationWeight(AvatarIKGoal.RightHand,0);

}


##3、动画曲线

++3.1、添加动画曲线

++++选择动画片断

++++添加动画曲线


++3.2、设置动画曲线


++3.3、编辑动画曲线

++++曲线X轴表明标准化时间,范围始终在0.01.0之间(无论持续时间多长,分别对应于动画片断的开始和结束)。

++++曲线的Y轴表明时间点对应的值。

++++动画曲线值能够经过获取参数值方法获取,值随着时间点的变化而变化。



##4、 动画事件

++4.1、什么时候用到动画事件

++++当你须要在角色动画播放到某一帧的时候须要作其余处理,举个例子,士兵丢炸弹是一个动画,可是炸弹在何时丢出去呢,按常理来说应该是当手举到头顶左右的地方丢出去。

++4.2、怎么用动画事件

++++在播丢炸弹动画的时候,在你想要丢出去的那一帧增长事件。

++4.3、设置动画事件

++++1、选择动画片断

++++2、添加动画事件


++++3、在动画执行过程当中的某一帧执行特定的方法


++++4、动画事件编辑界面


++++5、当动画执行到事件时间点时,会自动执行指定函数

--函数实现

void EventMethod(float value){

    print(value = + value);

}

--注意:

  --1、方法必须是放置在该人物对象身上的脚本组件中。

  --2、参数只能增长一个,且参数类型必须为以上四种(FloatIntStringObject)。



#立钻哥哥Unity 学习空间: http://blog.csdn.net/VRunSoftYanlz/

++立钻哥哥推荐的拓展学习连接(Link_Url

++++立钻哥哥Unity 学习空间: http://blog.csdn.net/VRunSoftYanlz/

++++Unity引擎基础http://www.javashuo.com/article/p-beommoeb-ka.html

++++Unity面向组件开发http://www.javashuo.com/article/p-eigmuvut-dt.html

++++Unity物理系统http://www.javashuo.com/article/p-nqvvciwv-kd.html

++++Unity2D平台开发http://www.javashuo.com/article/p-ycaagdtj-hs.html

++++UGUI基础http://www.javashuo.com/article/p-rukxwckw-mc.html

++++UGUI进阶http://www.javashuo.com/article/p-wcatruhq-gt.html

++++UGUI综合http://www.javashuo.com/article/p-dkccmqii-gg.html

++++Unity动画系统基础http://www.javashuo.com/article/p-mbrdouxy-dq.html

++++Unity动画系统进阶http://www.javashuo.com/article/p-aqaqpbkh-bp.html

++++Navigation导航系统http://www.javashuo.com/article/p-dswwllas-t.html

++++Unity特效渲染http://www.javashuo.com/article/p-ckojjyfj-bp.html

++++Unity数据存储http://www.javashuo.com/article/p-bvlzynso-m.html

++++Unity中Sqlite数据库http://www.javashuo.com/article/p-ejutsbxl-ca.html

++++WWW类和协程http://www.javashuo.com/article/p-dbwmhsav-cy.html

++++Unity网络http://www.javashuo.com/article/p-sqrlntgh-dw.html

++++C#事件http://www.javashuo.com/article/p-zmwruvql-gm.html

++++C#委托http://www.javashuo.com/article/p-uozpymaf-gh.html

++++C#集合http://www.javashuo.com/article/p-sfqfdqsf-ex.html

++++C#泛型http://www.javashuo.com/article/p-xrttqngo-ee.html

++++C#接口http://www.javashuo.com/article/p-vhlfplgv-dm.html

++++C#静态类https://blog.csdn.net/vrunsoftyanlz/article/details/78630979

++++C#中System.String类http://www.javashuo.com/article/p-olslkfao-cq.html

++++C#数据类型http://www.javashuo.com/article/p-hmabbtmc-ba.html

++++Unity3D默认的快捷键http://www.javashuo.com/article/p-wuwcrclr-s.html

++++游戏相关缩写http://www.javashuo.com/article/p-mwacxwca-gm.html

++++设计模式简单整理http://www.javashuo.com/article/p-rngqugib-hg.html

++++U3D小项目参考https://blog.csdn.net/vrunsoftyanlz/article/details/80141811

++++UML类图http://www.javashuo.com/article/p-sxberuew-bm.html

++++Unity知识点0001http://www.javashuo.com/article/p-ryvdxxjr-ep.html

++++U3D_Shader编程(第一篇:快速入门篇)http://www.javashuo.com/article/p-kyppgrac-gz.html

++++U3D_Shader编程(第二篇:基础夯实篇)http://www.javashuo.com/article/p-qkyowtli-hv.html

++++立钻哥哥Unity 学习空间: http://blog.csdn.net/VRunSoftYanlz/


--_--VRunSoft : Lovezuanzuan--_--