LessSimpleZone is a SimpleZone wrapper that provides extra features such as getting random points, checking if a point is inside the zone, updating volume, and combining zones, alongside the features of SimpleZone itself (as LessSimpleZone inherits from it), at the cost of more complexity in the code.
Documentation (not including SimpleZone):
Constructor
-
LessSimpleZone.fromBoxes(boxes: {{cframe: CFrame, size: Vector3}}, queryOp: QueryOptions?): LessSimpleZone
- This constructor is very similar to
SimpleZone.fromBoxes()
, but just returns a LessSimpleZone instead of a Zone, which has the additional features.
- This constructor is very similar to
-
LessSimpleZone.fromParts(parts: {Part}, queryOp: QueryOptions?): LessSimpleZone
- This constructor is very special as its methods allows you to do precise point calculations (such as getting random points in the precise shape of each part, checking if a point is within the bounds of this zone without the use of checker parts, etc.)
It took me very long to make this one work
- This constructor is very special as its methods allows you to do precise point calculations (such as getting random points in the precise shape of each part, checking if a point is within the bounds of this zone without the use of checker parts, etc.)
-
LessSimpleZone.fromBasePartsVertices(parts: {BasePart}, vertices: {Vector3}, queryOp: QueryOptions?): LessSimpleZone
- Unlike
LessSimpleZone.fromParts()
, this constructor accepts MeshParts AND Parts!
However, you do need to define your own vertices.
- Unlike
Methods
-
LessSimpleZone:GetRandomPoint(): Vector3
- This method does as it suggests, it returns a randomly placed point within the bounds of the
LessSimpleZone
.
This method does not involve the use of checker parts, at all.
- This method does as it suggests, it returns a randomly placed point within the bounds of the
-
LessSimpleZone:IsPointWithinZone(point: Vector3): boolean
- This method returns a boolean indicating wether or not
point
is located within the bounds of thisLessSimpleZone
or not.
Again, likeLessSimpleZone:GetRandomPoint()
, it is precise and does not involve the use of checker parts.
- This method returns a boolean indicating wether or not
-
LessSimpleZone:UpdateVolume(T...)
- This method updates the volume of this
LessSimpleZone
.
The arguments that it accepts varies depending on the type ofLessSimpleZone
, but it should tell you with the use of generic typechecking.
- This method updates the volume of this
-
LessSimpleZone:CombineWith(other: T)
- This method simply combines this
LessSimpleZone
withother
.
May be useful if you wish to consolidate multipleLessSimpleZone
volumes into one.
Note that you cannot combine different types ofLessSimpleZone
s together (for example cant combineLessSimpleZone
s made from boxes with ones made from parts, as they are fundamentally different.)
- This method simply combines this
Flaws
Even though the .fromParts() constructor can provide precise point calculations for parts, it can only do so for 4 PartTypes (Ball, Block, Wedge, Cylinder).
For most purposes this should suffice, however if you wish to create custom vertex groups you can look at the LessSimpleZone.Vertices
module which contains all of the vertex-defining information for parts, which you can use for your own point calculations.
Comparisons
GetRandomPoint comparison with ZonePlus (almost 100x faster!):
IsPointWithinZone comparison with ZonePlus (around 10x faster)
Geometry-precise generation of random points using vertices & barycentric coordinates (no checker parts!):
Download LessSimpleZone here →
LessSimpleZone.rbxm (21.4 KB)
Sorry if the writing seems sloppy or incomplete, I am EXTREMELy tired, have a great night.