Animation 混合树和动画不起作用

Animation 混合树和动画不起作用,animation,Animation,我正在尝试让我为角色制作的动画正常工作,但似乎有什么明显的问题,因为当我单击鼠标时,混合树和动画都没有激活 这是我使用的脚本: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.AI; public class Mover : MonoBehaviour { [SerializeField]转换目标; 无效更新() { if(Input.Get

我正在尝试让我为角色制作的动画正常工作,但似乎有什么明显的问题,因为当我单击鼠标时,混合树和动画都没有激活

这是我使用的脚本:

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

using UnityEngine.AI;

public class Mover : MonoBehaviour
{

[SerializeField]转换目标;
无效更新()
{
if(Input.GetMouseButtonDown(0))
{
MoveToCursor();
}
}
私有void MoveToCursor()
{
Ray-Ray=Camera.main.screenpointoray(输入.鼠标位置);
雷卡斯特击中;
bool hasHit=Physics.Raycast(射线,命中率高);
if(hasHit)
{
GetComponent().destination=hit.point;
}
}
私有void UpdateAnimator()
{
Vector3速度=GetComponent().velocity;
Vector3 localVelocity=变换。反转变换方向(速度);
浮动速度=本地速度.z;
GetComponent().SetFloat(“前进速度”,速度);
}
}

 [SerializeField] Transform target;

void Update()
{

    if (Input.GetMouseButtonDown(0))
    {
        MoveToCursor();
    }

}

private void MoveToCursor()
{

    Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
    RaycastHit hit;
    bool hasHit = Physics.Raycast(ray, out hit); 
    if (hasHit)
    {
        GetComponent<NavMeshAgent>().destination = hit.point;
    }


}

private void UpdateAnimator()
{
    Vector3 velocity = GetComponent<NavMeshAgent>().velocity;
    Vector3 localVelocity = transform.InverseTransformDirection(velocity);
    float speed = localVelocity.z;
    GetComponent<Animator>().SetFloat("forwardSpeed", speed);
}