From 5a1b126f1f6d55226c2b5068d0c17c428fd29ba8 Mon Sep 17 00:00:00 2001 From: Mel Date: Sun, 6 Aug 2023 04:27:07 +0200 Subject: Create separate Player entity and add bad collision system --- src/World/Position.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/World/Position.hpp') diff --git a/src/World/Position.hpp b/src/World/Position.hpp index bc874c0..91ec306 100644 --- a/src/World/Position.hpp +++ b/src/World/Position.hpp @@ -53,7 +53,7 @@ public: BlockLocal to_local() const { using namespace MC::World::ChunkDimensions; - return {Math::mod(x(), Width), y(), Math::mod(z(), Width)}; + return {Math::mod(x(), Width), std::clamp(y(), 0, Height), Math::mod(z(), Width)}; } }; @@ -73,7 +73,7 @@ public: MC_POSITION_MAKE_DEFAULT_CONSTRUCTORS(World, Real) BlockWorld round_to_block() const { - auto rounded = map([](auto x) { return std::round(x); }); + auto rounded = map([](auto x) { return std::floor(x); }); return {rounded.x(), rounded.y(), rounded.z()}; } }; -- cgit 1.4.1