csharp Time.deltaTime移动

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了csharp Time.deltaTime移动相关的知识,希望对你有一定的参考价值。

[SerializeField]
private float speed;

//  いい例
void Update(){
    var x = Input.GetAxis("Horizontal");
    var z = Input.GetAxis("Vertical");
    
    transform.position += new Vector3(x, 0, z) * speed * Time.deltaTime;
}

//  悪い例
void Update(){
    var x = Input.GetAxis("Horizontal");
    var z = Input.GetAxis("Vertical");
    
    transform.position += new Vector3(x, 0, z) * speed;
}

以上是关于csharp Time.deltaTime移动的主要内容,如果未能解决你的问题,请参考以下文章