unity---动画基础
2024-10-20 15:16:45
旧动画系统
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Move : MonoBehaviour
{
// Start is called before the first frame update
public float moveSpeed =5f;
public float roundSpeed=120f;
public Animation ani;
void Start(){
ani=this.GetComponent<Animation>();
}
public void Run(){
ani.Play("Run");
}
public void Jump(){
ani.Play("JumpUp");
}
public void Roll(){
ani.Play("Roll");
}
}
新动画系统
用Controller控制人物
添加动作Motion
点击箭头,设置动作转移条件
拖拽到Animation下
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Move : MonoBehaviour
{
public Animator at;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if(Input.anyKey){
at.SetBool("IsWalking",true);
//this.transform.Translate(Input.GetAxis("Vertical")*Vector3.forward*3f*Time.deltaTime);
// this.transform.Rotate(Input.GetAxis("Horizontal")*Vector3.up*1f);
}
else at.SetBool("IsWalking",false);
}
}
最新文章
- View and Data API Tips: how to make viewer full screen
- git版本控制管理实践-4
- f
- effective OC2.0 52阅读笔记(二 对象、消息、运行期)
- UVa 1611 (排序 模拟) Crane
- 修改的某人的SqlHelper FOR ODBC
- 高可用软件Keepalived
- 【转载】test和cmp比较
- JAVA Metrics 度量工具使用介绍
- Windows Azure入门教学系列 (六):使用Table Storage
- Kendo UI开发教程(26): 单页面应用(四) Layout
- 漫谈PID——实现与调参
- what i want
- HTTP协议之url详解
- ENVIRONMENT
- Quartz.Net定时任务EF+MVC版的web服务
- python——回文函数(reversed)
- Webservice发布
- hustoj搭建--常见问题
- 【ZABBIX】ZABBIX3.2升级3.4