From efd17623627607a26f33dac8f7ef1a1ddc931907 Mon Sep 17 00:00:00 2001 From: Mel Date: Thu, 7 Dec 2023 02:14:47 +0100 Subject: Gather all possibly colliding blocks in the player move domain for collision detection --- src/World/ChunkIndex.hpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/World/ChunkIndex.hpp') diff --git a/src/World/ChunkIndex.hpp b/src/World/ChunkIndex.hpp index 2e4fa67..bc61f3d 100644 --- a/src/World/ChunkIndex.hpp +++ b/src/World/ChunkIndex.hpp @@ -21,6 +21,10 @@ struct ChunkIndex { return {x * Width + local.x(), local.y(), y * Width + local.z()}; } + Position::BlockWorld world_position() const { + return local_to_world_position({0, 0, 0}); + } + static ChunkIndex from_position(Position::BlockWorld pos) { I32 chunk_x = std::floor((Real)pos.x() / ChunkDimensions::Width); I32 chunk_y = std::floor((Real)pos.z() / ChunkDimensions::Width); -- cgit 1.4.1