From 761fb71af33a560caede98497d2b90c87be74613 Mon Sep 17 00:00:00 2001 From: a dinosaur Date: Fri, 16 Aug 2024 00:48:05 +1000 Subject: [PATCH] prevent gameplay time delta getting too high --- Sources/Voxelotl/Game.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/Voxelotl/Game.swift b/Sources/Voxelotl/Game.swift index 2abbed8..3c8296c 100644 --- a/Sources/Voxelotl/Game.swift +++ b/Sources/Voxelotl/Game.swift @@ -42,11 +42,12 @@ class Game: GameDelegate { } func update(_ time: GameTime) { - let deltaTime = Float(time.delta.asFloat) fpsCalculator.frame(deltaTime: time.delta) { fps in print("FPS: \(fps)") } + let deltaTime = min(Float(time.delta.asFloat), 1.0 / 15) + player.update(deltaTime: deltaTime, boxes: boxes) camera.position = player.position camera.rotation =