Merge pull request #850 from MihailRis/physics-fixes

physics fixes
This commit is contained in:
MihailRis 2026-06-18 19:54:07 +03:00 • committed by GitHub
commit 90c06bb3ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -151,7 +151,10 @@ bool PhysicsSolver::calcCollisionNegY(
continue;
}
auto aabb = AABB(pos - half, pos + half);
aabb.scale(glm::vec3(1.0f - E * 4.0f, 1.0f - E * 2, 1.0f - E * 4.0f));
glm::vec3 scale(1.0f);
scale.x = 1.0f - E * 4.0f;
scale.z = 1.0f - E * 4.0f;
aabb.scale(scale);
auto boxhalf = box->getHalfSize();
if (box->position.y < pos.y && box->getAABB().intersects(aabb)) {
@ -241,7 +244,7 @@ void PhysicsSolver::calcCollisions(
float x = (pos.x - half.x + E) + ix;
for (int iz = 0; iz <= glm::ceil((half.z - E) * 2); iz++) {
float z = (pos.z - half.z + E) + iz;
float y = (pos.y + half.y + E) + 0.5f;
float y = (pos.y + half.y + E) - E;
if (auto aabb = chunks.isObstacleAt(x, y, z, boxAABB)) {
float newy = std::floor(y) - half.y + aabb->min().y - E;
if (pos.y >= newy) {