feat: add block detection while walking

This commit is contained in:
2026-03-14 16:32:41 +08:00
parent 8b1579b5fd
commit fd5314a1d1
5 changed files with 93 additions and 55 deletions

View File

@@ -11,6 +11,17 @@ World::~World() {
}
bool World::can_move(const glm::vec3& pos) const{
if (is_block(glm::floor(pos))) {
return false;
}
if (is_block(glm::floor(glm::vec3(pos.x, pos.y + 1.0f, pos.z)))) {
return false;
}
return true;
}
const BlockRenderData& World::get_block_render_data(int world_x, int world_y ,int world_z) {
int chunk_x, chunk_z;
if (world_x < 0) {