Region3s can have negative size very easily

> print(Region3.new(Vector3.new(1,1,1),Vector3.new(-3,-3,-3)).Size) -4, -4, -4

Just by supplying the lower vector second you can give a region3 negative size and then it won’t be able to detect anything with FindPartsInRegion3. It really shouldn’t even be possible for size to be negative.

It would be nice if the region3 constructor did this automatically:

local start_point = Vector3.new(5, 8, 5) local end_point = Vector3.new(8, 5, 8) Region3.new( Vector3.new( math.min(start_point.X, end_point.X), math.min(start_point.Y, end_point.Y), math.min(start_point.Z, end_point.Z) ), Vector3.new( math.max(start_point.X, end_point.X), math.max(start_point.Y, end_point.Y), math.max(start_point.Z, end_point.Z) ) )

2 Likes

[quote] It would be nice if the region3 constructor did this automatically:
[/quote]
While I agree this is useful, it means that it’s being changed from what you actually set it to which is quite bad practice. Instead, it should be able to account for a negative region as Ethan says.

Bumping because this is still relevant and causing issues:

Region3s should not be able to be negative. At the very least, negative axis values should be clamped to 0. Considering nothing will ever rely on a negative Region3 (or at least shouldn’t), making this change should not break anything.

2 Likes

Maelstronomer’s post sounds like a good idea. I should be able to give a region3 constructor any two corner points and construct a region from that. Currently behavior is confusing for new developers and annoying to work around for everyone else (have to manually convert to min/max)

1 Like