I’m creating a grid system which is composed of a group of cells. Each cell has an “Occupied” property, however it only sometimes works. The idea of it was that it would skip cells that would appear inside of parts, however it turns out that raycasting will not detect parts it’s inside of. This is my current code:
local Cell = Cells[GUID]; local origin = Cell.Position; local direction = CFrame.new(Cell.Position).lookVector.Unit; Cell.Occupied = workspace:Raycast(origin, direction, RaycastParams.new()) ~= nil;
I’m currently thinking of having rays which origins are farther from the cell, however then it’d only detect parts of certain sizes, and ignore the rest.