尽管使用了Time.deltaTime,但移动似乎与帧速率有关。
我有以下代码来计算在Unity中移动游戏对象所需的转换LateUpdate。据我了解,我对的使用Time.deltaTime应使最终的翻译帧速率独立(请注意CollisionDetection.Move(),仅用于进行射线广播)。 public IMovementModel Move(IMovementModel model) { this.model = model; targetSpeed = (model.HorizontalInput + model.VerticalInput) * model.Speed; model.CurrentSpeed = accelerateSpeed(model.CurrentSpeed, targetSpeed, model.Accel); if (model.IsJumping) { model.AmountToMove = new Vector3(model.AmountToMove.x, model.AmountToMove.y); } else if (CollisionDetection.OnGround) { model.AmountToMove = new Vector3(model.AmountToMove.x, 0); } model.FlipAnim = flipAnimation(targetSpeed); // If we're ignoring gravity, then just …