您的位置:首页 > 移动开发 > Unity3D

Unity_AnimatorLayers动画分层_068

2017-08-30 17:09 471 查看
第一步创建动画层





第二步添加遮罩Avatar Mask



第三步设置权重



模型上的源码:

using UnityEngine;
using System.Collections;

public class AvatarMaskTest : MonoBehaviour {

private Animator m_animator;
// Use this for initialization
void Start () {
m_animator = this.GetComponent<Animator>();
}

// Update is called once per frame
void Update () {
if (Input.GetKeyDown(KeyCode.R))
{
m_animator.SetBool("run",true);
}
if (Input.GetKeyUp(KeyCode.R))
{
m_animator.SetBool("run", false);
}

if (Input.GetKeyDown(KeyCode.J))
{
m_animator.SetBool("jump", true);
}
if (Input.GetKeyUp(KeyCode.J))
{
m_animator.SetBool("jump", false);
}
if (Input.GetKeyDown(KeyCode.W))
{
m_animator.SetBool("wave", true);
}
if (Input.GetKeyUp(KeyCode.W))
{
m_animator.SetBool("wave", false);
}
}
}


动画效果:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: