老师您好,在完成Stealth时,人物移动始终有延迟,并且还挺高的。不管怎么设置moveSpeed感觉对起步时候的延迟没有作用。停止时问题也一样,哪怕直接设置成0,还是往前滑动一会才停下。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Player : MonoBehaviour {
public float moveSpeed = 20;
private Animator anim;
// Use this for initialization
private void Awake() {
anim = this.GetComponent<Animator>();
}
// Update is called once per frame
void Update () {
float h = Input.GetAxis("Horizontal");
float v = Input.GetAxis("Vertical");
if(Mathf.Abs(h)>0.1 || Mathf.Abs(v)>0.1) {
float newSpeed=Mathf.Lerp(anim.GetFloat("Speed"), 5.6f, moveSpeed * Time.deltaTime);
anim.SetFloat("Speed", newSpeed);
} else {
anim.SetFloat("Speed", 0);
}
}
}