diff options
| author | Mel <einebeere@gmail.com> | 2023-12-07 02:14:47 +0100 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2023-12-07 02:14:47 +0100 |
| commit | efd17623627607a26f33dac8f7ef1a1ddc931907 (patch) | |
| tree | 76cf0389ae927bfc697c830155d926843178030e /src/World/ChunkIndex.hpp | |
| parent | 581f50e0bd45a19282d7958975997d376512b195 (diff) | |
| download | meowcraft-efd17623627607a26f33dac8f7ef1a1ddc931907.tar.zst meowcraft-efd17623627607a26f33dac8f7ef1a1ddc931907.zip | |
Gather all possibly colliding blocks in the player move domain for collision detection
Diffstat (limited to 'src/World/ChunkIndex.hpp')
| -rw-r--r-- | src/World/ChunkIndex.hpp | 4 |
1 files changed, 4 insertions, 0 deletions
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); |
