mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-09-07 19:21:14 -04:00
Was accidentally checking against steppingHeight instead of height.
Fixes #703
This commit is contained in:
parent
f9079be9ca
commit
e07a51c9d9
@ -286,13 +286,14 @@ pub const collision = struct {
|
|||||||
checkPos[index] += amount;
|
checkPos[index] += amount;
|
||||||
|
|
||||||
if (collision.collides(side, dir, -amount, checkPos, hitBox)) |box| {
|
if (collision.collides(side, dir, -amount, checkPos, hitBox)) |box| {
|
||||||
const height = box.max[2] - checkPos[2] + hitBox.max[2];
|
const newFloor = box.max[2] + hitBox.max[2];
|
||||||
if (height <= steppingHeight) {
|
const heightDifference = newFloor - checkPos[2];
|
||||||
|
if (heightDifference <= steppingHeight) {
|
||||||
// If we collide but might be able to step up
|
// If we collide but might be able to step up
|
||||||
checkPos[2] += steppingHeight;
|
checkPos[2] = newFloor + 0.0001;
|
||||||
if (collision.collides(side, dir, -amount, checkPos, hitBox) == null) {
|
if (collision.collides(side, dir, -amount, checkPos, hitBox) == null) {
|
||||||
// If there's no new collision then we can execute the step-up
|
// If there's no new collision then we can execute the step-up
|
||||||
resultingMovement[2] = height;
|
resultingMovement[2] = heightDifference;
|
||||||
return resultingMovement;
|
return resultingMovement;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user