Zone module similar to Region3

I made a Zone module similar to Region3. It does not have all the features of Region3s, but I will update it when I can.
The module has 1 function,

Zone.new(bottomLeftPosition, topRightPosition)

bottomLeftPosition is equivalent to min, and topRightPosition is equivalent to max in Region3s.

Zones have the properties:
bottomLeft: Vector3 - The bottom left Vector3 used to create the zone
topRight: Vector3 - The top right Vector3 used to create the zone
size: Vector3 - The size of the zone

Zones have the functions:
isInZone(position: Vector3) - Checks if a position is in a zone
getPartsInZone() - Returns a table containing all parts in a zone

Example of using the module:

local ReplicatedStorage = game:GetService('ReplicatedStorage') -- Getting the ReplicatedStorage service
local Workspace = game:GetService('Workspace') -- Getting the Workspace service

local Zone = require(ReplicatedStorage:WaitForChild('Zone')) -- Requiring the Zone module

local BottomLeftVector3 = Vector3.new(0, 0, 0)
local TopRightVector3 = Vector3.new(5, 5, 5)

local newZone = Zone.new(BottomLeftVector3, TopRightVector3) -- Creating a new zone

print(newZone.size) -- Vector3: 5, 5, 5
print(newZone.bottomLeft) -- Vector3: 0, 0, 0
print(newZone.topRight) -- Vector3: 5, 5, 5
print(newZone:getPartsInZone()) -- Returns a table containing all parts in the zone, can be used for collision detection
print(newZone:isInZone(Vector3.new(0, 2.5, 0))) -- true, because this position is inside the zone. Can be used to check if a part is in a zone

Please leave any feedback, bugs, features to add, etc. This is my first time making anything like this! (Also I am not saying this module is any faster than Region3s, I haven’t done any testing but I will in the near future.)

Module link: https://create.roblox.com/marketplace/asset/15669904579/Zones%3Fkeyword=&pageNumber=&pagePosition=

1 Like

I find this interface to be confusing and hard to use. I would much rather use a Position and Size for a zone. This is how most people will use it.

1 Like

Isn’t this how Region3s are defined? Maybe I could add 2 ways to define a zone.

Yes, but it still is not user friendly. Nobody, when making a zone, would know the bottom left and top right corners.

1 Like

Not necessarily, you can’t say that nobody would ever know that, but I will add support for a position and size to define a zone.