【发布时间】:2019-09-14 08:35:43
【问题描述】:
Rider IDE 通知我以下内容效率低下
transform.Translate(moveDirection * speed * Time.smoothDeltaTime);
想改写成
transform.Translate(Time.smoothDeltaTime * speed * moveDirection);
有人知道为什么吗?
都是乘法,有什么区别?
在某些情况下,这里是 speed 和 moveDirection 的值
private Vector3 moveDirection = Vector3.left;
private float speed = 2.5f;
我不明白为什么它更好?
谁能帮忙?
谢谢
【问题讨论】: