mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
update Entities::hasBlockingInside
This commit is contained in:
parent
717d41e7a5
commit
e1a996429f
1 changed files with 2 additions and 1 deletions
|
|
@ -492,10 +492,11 @@ void Entities::render(
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Entities::hasBlockingInside(AABB aabb) {
|
bool Entities::hasBlockingInside(AABB aabb) {
|
||||||
|
constexpr float eps = 0.05f;
|
||||||
auto view = registry->view<EntityId, Rigidbody>();
|
auto view = registry->view<EntityId, Rigidbody>();
|
||||||
for (auto [entity, eid, body] : view.each()) {
|
for (auto [entity, eid, body] : view.each()) {
|
||||||
AABB bodyAABB(body.hitbox.getAABB());
|
AABB bodyAABB(body.hitbox.getAABB());
|
||||||
bodyAABB.scale({1, 0.95f, 1});
|
bodyAABB.scale(glm::vec3(1.0f - eps));
|
||||||
if (eid.def.blocking && aabb.intersects(bodyAABB)) {
|
if (eid.def.blocking && aabb.intersects(bodyAABB)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue