How to get parts in grid cells without using Region3 or GetTouchingParts

I’m making a grid system for tornado damage, but I need a way to get parts in a cell and insert that into the cell table, how would I do this?

Here’s a visualization of the cells:

Here’s the code that creates the cells:

Now I need a way to get the parts in every cell and insert those parts into the grid cell table, the table is like this: self.Grid[cell pos] = { cell parts here }

How would I do this? I want to avoid Region3.

Have you tried using Spatial Queries?

I dont think those are optimised enough for like 10000 cells

Hm, spatial queries is a great method, and I don’t think any method at all would be able to handle that many cells at once without causing lag. Maybe make an Octree system to get just the nearest cells and get the parts inside those?

Does GetPartsBoundsInBox have a size limit?

I mainly just use GetPartsInPart, don’t know if that method has a size limitation, but making it just one big part theoretically should still require some resources, maybe make a test and see what works best for you.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.