mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-06-18 00:27:02 +08:00
feat: add collision detection
This commit is contained in:
@@ -12,15 +12,10 @@ World::~World() {
|
||||
|
||||
}
|
||||
|
||||
bool World::can_move(const glm::vec3& pos) const{
|
||||
bool World::can_move(const AABB& player_box) const{
|
||||
|
||||
if (is_block(glm::floor(glm::vec3(pos.x, pos.y - 0.5f, pos.z)))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_block(glm::floor(glm::vec3(pos.x, pos.y + 0.5f, pos.z)))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user