有一些表现上优化的小技巧。
currentVelocity = Vector3.Lerp(currentVelocity, targetMovementVelocity,
Fix64.One - Fix64.Pow(Fix64.E, -StableMovementSharpness * deltaTime));
速度的过渡,如果时间越长,就越接近1,时间越短,就越接近0。
速度差距越小,就越难接近,就是一个缓动。
currentVelocity = currentVelocity * (Fix64.One / (Fix64.One + (Drag * deltaTime)));
速度的过渡,如果时间越长,drag值越大,就越不容易到达1,否则反之。
速度差距越小,就越南接近,也是一个缓动。
帧率


网友评论