Is there a lightweight way of checking which region3 is containing a part?, that doesn’t involve just checking each one individually?
I’m trying to create a ambiance/lighting sysytem. that allows me to go from bright outdoors to dark and eerie interiors. To do this i’m creating 2 marker objects in a model, with the goal lighting stats, and ambient soundscape in a folder. Enter into the region and your lighting tweens to the goal, and the sound scape fades in. Works great in practice, but i feel like if i have too many “ambience regions” it could start to take a toll on performance.
would checking with a whitelist improve performance? or am I just micro-optimizing unnecessarily?
Right now i have
Function ReturnRegion3(Part)
for i,Region in pairs(Regions) do
if workspace:FindPartsInRegion3WithWhiteList(Region,{Part},1)[1] then
return Region
Break
end
end
end