I’m trying to make a system to judge weather exposure on a player- so if someone is outside during a blizzard, for example, they eventually die. The issue is, I want it to work for rooms of any shape, and detect if they have holes.
My previous version of this did a raycast up, and then in every cardinal direction (north, east, etc), but it had weaknesses- detecting a large room was one. If the raycasts detected too far, it’d consider a player sheltered even if they were outside. If it was too short, big rooms didnt count as shelter.
Im aware this is a bit of an unconventional post- I hope this is the right category? I dont want anyone to make the system for me, or design it for me, but I could really use the help with where to start on a system this (seemingly) complex.
Approach 3 fix
you can make a size threshold on the referenced part
game:GetService("RunService").Heartbeat:Connect(function(dt)
local Camera = workspace.CurrentCamera
local perams = RaycastParams.new()
perams.FilterDescendantsInstances = {workspace}
perams.FilterType = Enum.RaycastFilterType.Whitelist
local something1 = workspace:Raycast(Camera.CFrame.Position, Vector3.new(0, 200, 0), perams)
if something1 and something1.Instance.CanCollide and something1.Instance.Transparency < 0.8
and something1.Instance.Size.X > 5
and something1.Instance.Size.Y > 0.4
and something1.Instance.Size.Z > 5 then
-- if player is under a building
else
-- if player is not under a building
end
end)