Animation曲线创建
来源:互联网 发布:淘宝开店注册网址 编辑:程序博客网 时间:2024/05/23 16:43
using UnityEngine;using System.Collections;public class amimation : MonoBehaviour { float speed; AnimationClip aclip; AnimationCurve acurvex; AnimationCurve acurvey; AnimationCurve acurvez; Transform[] key;//bool // Use this for initialization void Start () { } // Update is called once per frame void Update () {// zz_animation ();// zz_animation2 (); zz_animation3 (); } void zz_animation() { if (Input.GetKey (KeyCode.W)) { this.animation.Play("runforward"); this.transform.Translate(Vector3.forward*Time.deltaTime); this.animation["runforward"].speed=1.0f; } else if(Input.GetKeyUp(KeyCode.W)) { this.animation.Play("idle"); } if(Input.GetKey(KeyCode.S)) { this.animation.Play("runbackwards"); this.transform.Translate(-(Vector3.forward)*Time.deltaTime); this.animation["runbackwards"].speed=1.0f; } else if(Input.GetKeyUp(KeyCode.S)) { this.animation.Play("idle"); } if(Input.GetKey(KeyCode.A)) { this.animation.Play("strafeleft"); this.transform.Translate((Vector3.left)*Time.deltaTime); this.animation["strafeleft"].speed=1.0f; } else if(Input.GetKeyUp(KeyCode.A)) { this.animation.Play("idle"); } if(Input.GetKey(KeyCode.D)) { this.animation.Play("straferight"); this.transform.Translate(-(Vector3.left)*Time.deltaTime); this.animation["straferight"].speed=1.0f; } else if(Input.GetKeyUp(KeyCode.D)) { this.animation.Play("idle"); } if (Input.GetKey (KeyCode.Space)) {// this.animation.Play("jump");// this.animation["jump"].speed=1.0f; } else if(Input.GetKey(KeyCode.Space)) { this.animation.Play("idle"); } } void zz_animation2() { if(Input.GetKey(KeyCode.W)) { this.animation.CrossFade ("runforward",1.5f); this.transform.Translate (Vector3.forward *Time.deltaTime); this.animation["runforward"].speed=1.0f; } else if(Input.GetKeyUp(KeyCode.W)) { this.animation.Play("idle"); } if(Input.GetKey(KeyCode.S)) { this.animation.CrossFade ("runbackwards",1.5f); this.transform.Translate (-Vector3.forward *Time.deltaTime); this.animation["runbackwards"].speed=1.0f; } else if(Input.GetKeyUp(KeyCode.S)) { this.animation.Play("idle"); } if(Input.GetKey(KeyCode.A)) { this.animation.CrossFade ("strafeleft",1.5f); this.transform.Translate (Vector3.left *Time.deltaTime); this.animation["strafeleft"].speed=1.0f; } else if(Input.GetKeyUp(KeyCode.A)) { this.animation.Play("idle"); } if(Input.GetKey(KeyCode.D)) { this.animation.CrossFade ("straferight",1.5f); this.transform.Translate (-(Vector3 .left ) *Time.deltaTime); this.animation["straferight"].speed=1.0f; } else if(Input.GetKeyUp(KeyCode.D)) { this.animation.Play("idle"); } } void zz_animation3() { acurvex = new AnimationCurve (new Keyframe(0,transform.localPosition.x), new Keyframe(1,key[0].position.x), new Keyframe(2,key[1].position.x), new Keyframe(3,key[2].position.x), new Keyframe(4,key[3].position.x), new Keyframe(5,transform.localPosition.x)); acurvez =AnimationCurve.EaseInOut(0,transform.localPosition.z,key .Length +1,transform.localPosition.z); for(int i=0;i<key.Length;i++) { acurvez.AddKey(i,key[i].position.z); } acurvey = AnimationCurve .Linear (0,transform .position.y,key.Length+1,transform.localPosition.y); aclip.SetCurve ("",typeof(Transform),"localPosition",acurvex); aclip.SetCurve ("",typeof(Transform),"localPosition",acurvey); aclip.SetCurve ("",typeof(Transform),"localPosition",acurvez);// animation.AddClip (clip:); }}
0 0
- Animation曲线创建
- Core Animation 曲线公式
- Unity/Animation -- 创建Animation Clip
- Unity/Animation -- 创建Animation Clip
- Unity-Animation动画曲线弯曲问题
- Flex LineChart动态创建曲线
- 沿曲线创建圆柱体 mayaAPI
- 动画神器:贝塞尔曲线——Property Animation
- Animation 加载动画的创建
- PhotoShop钢笔工具创建直线和曲线
- Unity -- Bezier曲线(创建/编辑工具)
- 创建曲线偏置根据指定矢量
- QtCharts_动态图QSplineSeries 创建平滑曲线
- android学习 如何创建Tween Animation?
- android中,如何创建Frame Animation?
- Animation中xml文件创建技巧
- Unity3D背景动画创建 使用Animation
- 3Animation动画的创建,CCSpeed,CCFollow
- php笔记
- mongodb查询内嵌文档
- Hbase分布式安装
- 龙芯Ejtag调试工具使用说明
- HDFS——如何从HDFS上读取文件内容
- Animation曲线创建
- 基础总结篇:Activity的四种launchMode
- 多线程编程程序关闭了,但进程还在的解决方案
- NavMeshAgent 物体随机方向移动
- 这道题用递归该怎样写呢?
- C#拼图
- FTP的ASCII和Binary传输模式
- 选择合适的协议
- 1004. 成绩排名 (20)