I’m creating a tile-based game with chunks, I’ve implemented a player field of view (FOV) using attachments and raycasts, which dynamically adjust the visible area.
local RunService = game:GetService("RunService")
local CollectionService = game:GetService("CollectionService")
local Camera = Workspace.CurrentCamera
local Tiles = CollectionService:GetTagged("Tile")
RunService.RenderStepped:Connect(function()
for _,Tile in Tiles do
local _,OnScreen = Camera:WorldToScreenPoint(Tile.Position)
if OnScreen then
print(Tile.Name,"On Screen")
end
end
end)
Note that you could do alot to further optimize this, and it doesnt account for tiles created during runtime (you’d want to implement this for slow load times / issues with streaming enabled)