在Unity中将动画添加到我的3d模型中?

时间:2018-08-11 15:33:17

标签: c# unity3d unity3d-editor

我是一个问题,我认为它很难解决,但尚未解决,我想我缺少了一些东西,嗯,我有一个带有动画的角色(正在运行的动画),另一个带有另一个动画的角色在我的模型上效果很好,我希望我的播放器跳起来,然后在单击按钮时返回他的运行动画...

我有两个动画:

enter image description here

我已经创建了animatorController:

enter image description here

我将角色添加到场景中并附加了AnimatorController,当然,我创建了一个脚本(代码在脚本中):

private Animator animator;

private void Start () {
    // Position left and right
    obj = GetComponent<Transform> ();
    posCenter = obj.position.x;
    // used for Jump anim
    animator = GetComponent<Animator>();
}

private void Update () {
    obj = GetComponent<Transform> ();

    if (Swipe() == "up"){
        //transform.Translate (Vector3.back * (speed * Time.deltaTime),Space.Self);
        animator.Play("Jump");
    }

对于“角色运行”动画,其持续时间为32,而“跳转”动画为23,但是当我单击模型时,我得到的是:

enter image description here

我不知道如何在此处添加动画...我想我在这里有一个问题,但是我不确定这是否是唯一的问题,我单击了“ +”按钮,但是没有用。

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

给手表看

https://www.youtube.com/watch?v=wdOk5QXYC6Y

您可能只需要前10到15分钟-但是,如果您使用的是动画控制器,则与通过代码使用旧版系统稍有不同。