Merge branch 'main' into particles-first
This commit is contained in:
commit
f04d197047
@ -437,12 +437,16 @@ void PlayerController::processRightClick(const Block& def, const Block& target)
|
|||||||
}
|
}
|
||||||
blockid_t chosenBlock = def.rt.id;
|
blockid_t chosenBlock = def.rt.id;
|
||||||
|
|
||||||
AABB blockAABB(coord, coord + 1);
|
|
||||||
bool blocked = level->entities->hasBlockingInside(blockAABB);
|
|
||||||
|
|
||||||
if (def.obstacle && blocked) {
|
if (def.obstacle) {
|
||||||
|
std::vector<AABB> hitboxes = def.rotatable ? def.rt.hitboxes[state.rotation] : def.hitboxes;
|
||||||
|
for (AABB blockAABB : hitboxes) {
|
||||||
|
bool blocked = level->entities->hasBlockingInside(blockAABB.move(coord));
|
||||||
|
if (blocked) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
auto vox = chunks->get(coord);
|
auto vox = chunks->get(coord);
|
||||||
if (vox == nullptr) {
|
if (vox == nullptr) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -34,6 +34,10 @@ struct AABB {
|
|||||||
return (a + b) * 0.5f;
|
return (a + b) * 0.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline AABB move(glm::vec3 pos) const {
|
||||||
|
return AABB(a + pos, b + pos);
|
||||||
|
}
|
||||||
|
|
||||||
/// @brief Multiply AABB size from center
|
/// @brief Multiply AABB size from center
|
||||||
inline void scale(const glm::vec3 mul) {
|
inline void scale(const glm::vec3 mul) {
|
||||||
glm::vec3 center = (a + b) * 0.5f;
|
glm::vec3 center = (a + b) * 0.5f;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user