mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-11 22:11:51 +00:00
fix side collision position correction for blocks
This commit is contained in:
parent
a8dd5e9cb3
commit
794ce07bd5
1 changed files with 1 additions and 1 deletions
|
|
@ -106,7 +106,7 @@ static void calc_collision(
|
||||||
if (const auto obstacle = chunks.isObstacleAt(coord.x, coord.y, coord.z, aabb)) {
|
if (const auto obstacle = chunks.isObstacleAt(coord.x, coord.y, coord.z, aabb)) {
|
||||||
float newx = std::floor(coord[nx]) - half[nx] * sign +
|
float newx = std::floor(coord[nx]) - half[nx] * sign +
|
||||||
(sign > 0 ? obstacle->min() : obstacle->max())[nx];
|
(sign > 0 ? obstacle->min() : obstacle->max())[nx];
|
||||||
if ((pos[nx] - newx) * sign > 0.0f) {
|
if ((pos[nx] - newx) * sign > 0.0f && glm::abs(pos[nx] - newx) < MAX_FIX) {
|
||||||
vel[nx] = 0.0f;
|
vel[nx] = 0.0f;
|
||||||
pos[nx] = newx;
|
pos[nx] = newx;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue