I’ve made a node generation module script, which uses a region part to generate nodes in memory. Everything works as expected except, there is an issue which comes to deciding whether a specific position is valid for the node to generate.
The way I check wether a certain position is valid, is by using “workspace:GetPartsInPart”. I have certain parts place which have 3 specific collision groups.
“LegalBounds” means that it is always valid
“IllegalBounds” means that it is always invalid
“NodeBounds” this is just the collision group for the region part. It’s used to detect if the part is in the region part
If non of those collision groups were detected, I assume that the part is inside a random part, and that that’s invalid.
The main issue comes with the fact that checking for collision group, concludes with different results most of time which means it’s inefficient. I use one part and move throughout the region to these checks. I’ve tried using workspace:GetPartsBoundInBox and workspace:GetPartsBoundInRadius but all of those return bounding boxes while in my case I need to to use an objects geometry.
If you place down part, remove their and give them either Illegal or Legal bound collision groups. You’ll see what I’m talking about. Making the node region has a collision group of „NodeBounds“.
Here is the module script. Any help will be very appreciated.
NodeGenerator.rbxm (4.2 KB)
Also if anyone finds any optimisation ideas, feel free to share