Legacy动画系统:Animation组件(旧)

Mecanim动画系统:Animator组件(新)

动画播放过程:

//动画片段
[System.Serializable]
public class Anim
{
public AnimationClip idle;
public AnimationClip runForward;
public AnimationClip runBackward;
public AnimationClip runRight;
public AnimationClip runLeft;
} public class PlayerCtrl : MonoBehaviour
{
public Anim anim;
public Animation _animation; void Start()
{
tr = GetComponent<Transform>();
_animation = GetComponentInChildren<Animation>(); //_animation.clip = anim.idle;
//_animation.Play();
} void Update()
{
h = Input.GetAxis("Horizontal");
v = Input.GetAxis("Vertical"); Vector3 moveDir = (Vector3.forward * v) + (Vector3.right * h);
tr.Translate(moveDir.normalized * Time.deltaTime * moveSpeed, Space.Self);
tr.Rotate(Vector3.up * Time.deltaTime * rotSpeed * Input.GetAxis("Mouse X")); if (v >= 0.1F)
{
_animation.CrossFade(anim.runForward.name, 0.3F);
}
else if (v <= -0.1F)
{
_animation.CrossFade(anim.runBackward.name, 0.3F);
}
else if (h >= 0.1F)
{
_animation.CrossFade(anim.runRight.name, 0.3F);
}
else if (h <= -0.1F)
{
_animation.CrossFade(anim.runLeft.name, 0.3F);
}
else
{
_animation.CrossFade(anim.idle.name, 0.3F);
}
}

这个过程是很重要的,通过获取到的坐标的大小进行播放不同的动画,并且有着平稳的过度。

Unity 动画系统的更多相关文章

  1. Unity 动画系统 Animation 和 Animator的小实例

    本文结合一个很简单的动画demo,分别采用2种方法,来对比Animation和Animator的使用方式: 方法1:单独使用Animation 方法2:Animation结合Animator 动画De ...

  2. Unity 动画系统(Mecanim) 术语及翻译 表格

    原文 翻译 Animation Clip 视频片段 Avatar 阿凡达 Retargeting 重定向 Rigging 绑定 skinning 蒙皮 Animator Component 动画组件 ...

  3. Unity 动画系统 Animation和Animator 常用小功能

  4. Unity 动画系统 Animation和Animator等常用类

  5. Unity 动画系统 AnimationEvent 动画事件

  6. Unity 动画系统 StateMachineBehaviour 动画状态机

  7. Unity 动画系统 Animation 和 Animator 联系与区别

  8. Unity 动画系统(Mecanim)的组成结构

    三部分: Model Rigging(直译传动装置,术语翻译绑定)(连接Model与Animations) Animations

  9. Unity Animation System(动画系统)

    动画系统: 支持:动画融合,混合,叠加动画,行走循环的时间同步,动画层,控制动画的各个方面(时间,速度,融合权重)   带有每顶点1.2或4骨骼的蒙皮网格,以及支持基于物理的布娃娃系统和程序动画.   ...

随机推荐

  1. MySQL 修改账号的IP限制条件

    今天遇到一个需求:修改MySQL用户的权限,需要限制特定IP地址才能访问,第一次遇到这类需求,结果在测试过程,使用更新系统权限报发现出现了一些问题, 具体演示如下. 下面测试环境为MySQL 5.6. ...

  2. web.xml设置过滤直接访问

    <security-constraint> <web-resource-collection> <web-resource-name>JSPs</web-re ...

  3. 第一个 java 程序

    java程序的运行机制 JVM实现了跨平台 JDK > JRE > JVM java Development Kit(JDK)包含:JRE,以及增加编译器和调试器等用于程序开发的文件 Ja ...

  4. 连接到github

    1,创建秘钥 $ ssh-keygen -t rsa -C "youremail@example.com"执行成功后,会在~/.ssh/目录下生成id_rsa和id_rsa.pub ...

  5. IDEWorkspaceChecks.plist文件是干什么用的?

    在提交PR的时候,无意间发现了在xcworkspace/xcshareddata中多了一个名为IDEWorkspaceChecks.plist的文件.自己并没有手动创建此文件,在网上查了一下,最终对其 ...

  6. Offset Management For Apache Kafka With Apache Spark Streaming

    An ingest pattern that we commonly see being adopted at Cloudera customers is Apache Spark Streaming ...

  7. linux服务器硬盘IO读写负载高来源定位 pt-ioprofile

    首先 .用top命令查看   1 2 3 4 5 top - 16:15:05 up 6 days,  6:25,  2 users,  load average: 1.45, 1.77, 2.14 ...

  8. Python编码规范(PEP8)及奇技淫巧(不断更新)

    https://blog.csdn.net/MrLevo520/article/details/69155636

  9. day12-内置模块学习(三)

    我的博客呀,从以前的预习变成了复习了,复习的东西还没有写完,哎 今日目录 1.序列化模块 2.加密模块 3.包的使用 4.random模块 5.shutil模块 开始今日份总结 1.序列化模块 在学习 ...

  10. Openwrt自定义CGI实现

    此文已由作者吴志勐授权网易云社区发布. 欢迎访问网易云社区,了解更多网易技术产品运营经验. 安装uhttpd. 在编译openwrt前,输入make memuconfig,查找Network -> ...