Skip to content

Commit aef29da

Browse files
committed
remove negative checks for box_shape
1 parent 2dcfbe9 commit aef29da

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

azalea-physics/src/collision/shape.rs

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,9 @@ pub fn box_shape(
2626
max_y: f64,
2727
max_z: f64,
2828
) -> VoxelShape {
29-
assert!(min_x >= 0., "min_x must be >= 0 but was {min_x}");
30-
assert!(min_y >= 0.);
31-
assert!(min_z >= 0.);
32-
assert!(max_x >= 0.);
33-
assert!(max_y >= 0.);
34-
assert!(max_z >= 0.);
35-
36-
box_shape_unchecked(min_x, min_y, min_z, max_x, max_y, max_z)
37-
}
29+
// we don't check for the numbers being out of bounds because some blocks are
30+
// weird and are outside 0-1
3831

39-
pub fn box_shape_unchecked(
40-
min_x: f64,
41-
min_y: f64,
42-
min_z: f64,
43-
max_x: f64,
44-
max_y: f64,
45-
max_z: f64,
46-
) -> VoxelShape {
4732
if max_x - min_x < EPSILON && max_y - min_y < EPSILON && max_z - min_z < EPSILON {
4833
return EMPTY_SHAPE.clone();
4934
}
@@ -591,7 +576,7 @@ impl VoxelShape {
591576

592577
impl From<AABB> for VoxelShape {
593578
fn from(aabb: AABB) -> Self {
594-
box_shape_unchecked(
579+
box_shape(
595580
aabb.min.x, aabb.min.y, aabb.min.z, aabb.max.x, aabb.max.y, aabb.max.z,
596581
)
597582
}

0 commit comments

Comments
 (0)