mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 11:01:49 +00:00
fix colision check on block place
This commit is contained in:
parent
513b96ea4d
commit
726ee8ad70
2 changed files with 12 additions and 4 deletions
|
|
@ -437,11 +437,15 @@ void PlayerController::processRightClick(const Block& def, const Block& target)
|
|||
}
|
||||
blockid_t chosenBlock = def.rt.id;
|
||||
|
||||
AABB blockAABB(coord, coord + 1);
|
||||
bool blocked = level->entities->hasBlockingInside(blockAABB);
|
||||
|
||||
if (def.obstacle && blocked) {
|
||||
return;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
auto vox = chunks->get(coord);
|
||||
if (vox == nullptr) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue