RotatedRegion3:FindPartsInRegion3 Confusion

I’ve discoved EgoMooses’ RotatedRegion3 Module but I’m confused on how to use FindPartsInRegion3 for this module. The explanation EgoMoose gave:

“RotatedRegion3:FindPartsInRegion3(Instance ignore, Integer maxParts)
returns array of parts in the RotatedRegion3 object
will return a maximum number of parts in array [maxParts] the default is 20
parts that either are descendants of or actually are the [ignore] instance will be ignored”

I’m unsure what the “Instance ignore” is, but I understand maxparts.

I tried inserting the region into the Instance Ignore, but the output gave “Argument 1 missing or nil” for the module script line 210.

A scripted example on how to use this would be greatly appreciated.

Hello d_vone!

I am only semi-familiar with the Rotated Region 3 module by EgoMoose, but I think I understand what your issue is. Reference to my code below with explanations.

local RotatedRegion3 = require(game.ServerScriptService.RotatedRegion3)
--
local region = RotatedRegion3.new(CFrame.new(),Vector3.new()) --We find the CFrame of the region we want to create (will be the origin) and get the size. A great way to do this is through :GetBoundingBox() if it is a model.
--
local partsinregion3 = RotatedRegion3:FindPartsInRegion3(region) --We use our previous created region to find the parts in it. The second parameter of this call is MaxParts, but it is completely optional. Leaving it blank will return every part in the region.

Assuming you are using EgoMoose’s RotatedRegion3 reference sheet, you can look at the two categories he provides. Constructors will create a region and you can call methods with regions as the first parameter.

Please let me know if this does not work. I have not used his module in my code before, so I can’t call myself an expert on this.

Instance ignore is basically the instance you want to ignore, simple.
So lets say you have a model in the region, but you dont want the region to detect it. Just set the Instance ignore to that model.

You can leave it as nil if you dont want any ignored instance

The module outputs " Unable to cast value to Object"
Thats the same output it was giving me when I wrote this post.
(Sorry for the belated response)