为了账号安全,请及时绑定邮箱和手机立即绑定

Unity 触发输入无法播放动画

Unity 触发输入无法播放动画

C#
慕田峪7331174 2021-10-09 10:12:52
我是 c# 的菜鸟。当刚体进入设置为 Is Trigger 的盒对撞机时,我一直在尝试触发动画“命中”。我有动画剪辑,控制台显示我有“进入触发器”。一旦发生这种情况,我似乎无法播放我的动画剪辑。顺便说一下,这是关于 3D 模型的。任何人都可以帮忙吗?    using System.Collections;    using System.Collections.Generic;    using UnityEngine;    public class newAttack : MonoBehaviour {        public GameObject tiger;        public AnimationClip attack;        private Animation myAnimation;      /*  IEnumerator Wait()        {            myAnimation = GetComponent<Animation>();            myAnimation.Play(attack.name);            yield return new WaitForSeconds(3);        }    */        void OnTriggerEnter(Collider other)        {            Debug.Log("Entered Trigger");            myAnimation = GetComponent<Animation>();            myAnimation.Play(attack.name);           // StartCoroutine(Wait());        }// Use this for initialization        // Update is called once per frame        void Update () {       }    }
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 236 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号