Multiple Hitboxes

This commit is contained in:
InfiniteCoder
2024-02-24 00:21:17 +03:00
parent d1fbaaa28b
commit 5f551d6888
4 changed files with 42 additions and 17 deletions
+9
View File
@@ -151,6 +151,15 @@ void ContentLoader::loadBlock(Block& def, std::string name, fs::path file) {
aabb.a = glm::vec3(boxarr->num(0), boxarr->num(1), boxarr->num(2));
aabb.b = glm::vec3(boxarr->num(3), boxarr->num(4), boxarr->num(5));
aabb.b += aabb.a;
def.hitboxExplicit = true;
} else if (def.modelBoxes.empty()) {
def.hitboxExplicit = true;
} else {
def.hitbox = def.modelBoxes[0];
for (const auto& box : def.modelBoxes) {
def.hitbox.a = glm::min(def.hitbox.a, box.a);
def.hitbox.b = glm::max(def.hitbox.b, box.b);
}
}
// block light emission [r, g, b] where r,g,b in range [0..15]