mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 20:41:49 +00:00
fix teleports loop on low obstacles
This commit is contained in:
parent
a4f043c859
commit
e28af89de2
1 changed files with 2 additions and 5 deletions
|
|
@ -151,10 +151,7 @@ bool PhysicsSolver::calcCollisionNegY(
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
auto aabb = AABB(pos - half, pos + half);
|
auto aabb = AABB(pos - half, pos + half);
|
||||||
glm::vec3 scale(1.0f);
|
aabb.scale(glm::vec3(1.0f - E * 4.0f, 1.0f - E * 2, 1.0f - E * 4.0f));
|
||||||
scale.x = 1.0f - E * 4.0f;
|
|
||||||
scale.z = 1.0f - E * 4.0f;
|
|
||||||
aabb.scale(scale);
|
|
||||||
|
|
||||||
auto boxhalf = box->getHalfSize();
|
auto boxhalf = box->getHalfSize();
|
||||||
if (box->position.y < pos.y && box->getAABB().intersects(aabb)) {
|
if (box->position.y < pos.y && box->getAABB().intersects(aabb)) {
|
||||||
|
|
@ -279,7 +276,7 @@ void PhysicsSolver::calcCollisions(
|
||||||
// step on
|
// step on
|
||||||
if (stepHeight > 0.0 && vel.y <= 0.0f) {
|
if (stepHeight > 0.0 && vel.y <= 0.0f) {
|
||||||
AABB boxAABB = AABB(pos - half, pos + half);
|
AABB boxAABB = AABB(pos - half, pos + half);
|
||||||
boxAABB.scale(glm::vec3(1.0f - E * 2, 1.0f - E * 2, 1.0f - E * 2));
|
boxAABB.scale(glm::vec3(1.0f - E * 4.0f, 1.0f - E * 2, 1.0f - E * 4.0f));
|
||||||
for (int ix = 0; ix <= glm::ceil((half.x - E) * 2); ix++) {
|
for (int ix = 0; ix <= glm::ceil((half.x - E) * 2); ix++) {
|
||||||
float x = (pos.x - half.x) + ix;
|
float x = (pos.x - half.x) + ix;
|
||||||
for (int iz = 0; iz <= glm::ceil((half.z - E) * 2); iz++) {
|
for (int iz = 0; iz <= glm::ceil((half.z - E) * 2); iz++) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue