From e45f63c3150056bac37591b53365e9c602f147c9 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Sun, 4 Aug 2024 16:53:05 +0300 Subject: [PATCH 1/2] fix: camera shaking while paused --- src/logic/PlayerController.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/logic/PlayerController.cpp b/src/logic/PlayerController.cpp index c86e01dd..10707fc1 100644 --- a/src/logic/PlayerController.cpp +++ b/src/logic/PlayerController.cpp @@ -260,7 +260,7 @@ void PlayerController::postUpdate(float delta, bool input, bool pause) { camControl.updateMouse(this->input); } player->postUpdate(); - camControl.update(this->input, delta, level->chunks.get()); + camControl.update(this->input, pause ? 0.0f : delta, level->chunks.get()); if (input) { updateInteraction(); } else { From d59491f63ad61e5ad78b89730b99c383b1edb883 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Sun, 4 Aug 2024 16:57:34 +0300 Subject: [PATCH 2/2] update entity Transform epsilon --- src/objects/Entities.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/objects/Entities.hpp b/src/objects/Entities.hpp index eb4d963f..e311c7a7 100644 --- a/src/objects/Entities.hpp +++ b/src/objects/Entities.hpp @@ -38,6 +38,7 @@ struct EntityId { }; struct Transform { + static inline constexpr float EPSILON = 0.0000001f; glm::vec3 pos; glm::vec3 size; glm::mat3 rot; @@ -55,14 +56,14 @@ struct Transform { } inline void setSize(glm::vec3 v) { - if (glm::distance2(displaySize, v) >= 0.00001f) { + if (glm::distance2(displaySize, v) >= EPSILON) { dirty = true; } size = v; } inline void setPos(glm::vec3 v) { - if (glm::distance2(displayPos, v) >= 0.0001f) { + if (glm::distance2(displayPos, v) >= EPSILON) { dirty = true; } pos = v;