Quenty suggested the name change
[size=5]Hey![/size] I spent some time coming up with a box collision function, and decided to use it to make rotatable region3s! My region module and ROBLOX’s Region3’s have the same functionality, except mine are rotatable, and you can do more. lol. (They’re also a fair bit slower, but then again, what do you expect?) You can grab it there:
Do yourself a favor and don’t read it k?
[size=5]Example usage[/size]
local Region=require(script.Parent.ModuleScript)
--Makes a new Region from Part
local r=Region.FromPart(game.Workspace.Part)
--Gets all parts in the Region except for Part
local Parts=r:Cast(game.Workspace.Part)
for i=1,#Parts do
print(Parts[i])
end
--Tells you if OtherPart is intersecting Region r
local isPartInRegion=r:CastPart(game.Workspace.OtherPart)
print(isPartInRegion)
[size=5]Documentation[/size]
By AxisAngle, (Trey Reynolds)
Documentation
Region constructors:
Region Region.new(CFrame RegionCFrame, Vector3 RegionSize)
>Returns a new Region object
Region Region.FromPart(Instance Part)
>Returns a new Region objects
Region methods:
table Region:Cast([Instance or table Ignore])
>Returns all parts in the Region, ignoring the Ignore
bool Region:CastPart(Instance Part)
>Returns true if Part is within Region, false otherwise
table Region:CastParts(table Parts)
>Returns a table of all parts within the region
bool Region:CastPoint(Vector3 Point)
>Returns true if Point intersects Region, false otherwise
bool Region:CastSphere(Vector3 SphereCenter, number SphereRadius)
>Returns true if Sphere intersects Region, false otherwise
bool Region:CastBox(CFrame BoxCFrame, Vector3 BoxSize)
>Returns true if Box intersects Region, false otherwise
Region properties: (Regions are mutable)
CFrame CFrame
Vector3 Size
Region3 Region3
Region functions:
Region3 Region.Region3BoundingBox(CFrame BoxCFrame,Vector3 BoxSize)
>Returns the enclosing boundingbox of Box
table Region.FindAllPartsInRegion3(Region3 Region3, [Ignore])
>Returns all parts within a Region3 of any size
bool Region.BoxPointCollision(CFrame BoxCFrame, Vector3 BoxSize, Vector3 Point)
>Returns true if the Point is intersecting the Box, false otherwise
bool Region.BoxSphereCollision(CFrame BoxCFrame, Vector3 BoxSize, Vector3 SphereCenter, number SphereRadius)
>Returns true if the Sphere is intersecting the Box, false otherwise
bool Region.BoxCollision(CFrame Box0CFrame, Vector3 Box0Size, CFrame Box1CFrame, Vector3 Box1Size, [bool AssumeTrue])
>Returns true if the boxes are intersecting, false otherwise
If AssumeTrue is left blank, it does the full check to see if Box0 is intersecting Box1
If AssumeTrue is true, it skips the heavy check and assumes that any part that could possibly be in the Region is
If AssumeTrue is false, it skips the heavy check and assumes that any part that could possible be outside the Region is