diff --git a/internal/entity/physics.go b/internal/entity/physics.go index e2726df..98fa6d9 100644 --- a/internal/entity/physics.go +++ b/internal/entity/physics.go @@ -25,6 +25,13 @@ const MoveEps = 1e-7 // It does not change anything in e. func (e *Entity) move(delta itype.Vec3d, w *world.World) (finDelta itype.Vec3d, finVelocity itype.Vec3d, onGround bool) { + // Truncate the delta to [0, 1] + for i := 0; i < len(delta); i++ { + if math.Abs(delta[i]) > 1 { + delta[i] /= math.Abs(delta[i]) + } + } + // Get the hitboxes and the blocks region covering it hb := e.WorldHitbox() hbmin, hbmax := itype.Vec3d{1000000000, 1000000000, 1000000000}, itype.Vec3d{-1000000000, -1000000000, -1000000000}