简单的动画混合 Animation Mixing.docx

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
简单的动画混合 Animation Mixing Posted on 2013年06月27日 by U3d / \o 查看 Unity3D脚本/插件 中的全部文章 Unity3D脚本/插件/被围观 33 次 Animation Mixing (动画混合),什么是动画混合呢?举个简单的例子吧,一个模型现在有3种动作,分别是idle、walk、shoot,在Unity3D中一个Layer只能播放二种动画,shoot动作只影响左肩膀的骨骼,而不会影响腿部的动作,所有这里就可以把shoot和walk进行Mixing。 01 function Start () 02 { 03 04 //增加一个动画剪辑片段 05 06 // 07 animation.AddClip(animation[shoot].clip, shootUpperBody); 08 animation[shootUpperBody].AddMixingTransform(transform.Find(mover/gun)); //@parm 路径 09 animation[shootUpperBody].AddMixingTransform(transform.Find(mover/roothandle/spine1)); 10 //设置动画模式 11 animation.wrapMode = WrapMode.Loop; 12 13 animation[jump].wrapMode = WrapMode.Clamp; 14 animation[shoot].wrapMode = WrapMode.Clamp; 15 animation[shootUpperBody].wrapMode = WrapMode.Clamp; 16 17 // Put idle and run in a lower layer. They will only animate if our action animations are not playing 18 animation[idle].layer = -1; 19 animation[run].layer = -1; 20 21 animation.Stop(); 22 } 23 //Unity3D教程手册: 24 25 function Update () { 26 if (Mathf.Abs(Input.GetAxis(Vertical)) 0.1) 27 { 28 animation.CrossFade(run); 29 animation[run].speed = Mathf.Sign(Input.GetAxis(Vertical)); 30 } 31 else 32 animation.CrossFade(idle); 33 34 if (Input.GetButtonDown (Jump)) 35 { 36 animation.CrossFade(jump, 0.3); 37 } 38 if (Input.GetButtonDown (Fire1)) 39 { 40 if (animation[run].weight 0.5) 41 animation.CrossFadeQueued(shootUpperBody, 0.3, QueueMode.PlayNow); 42 else 43 animation.CrossFadeQueued(shoot, 0.3, QueueMode.PlayNow); 44 }

文档评论(0)

zzqky + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档