This will check whether the center of the blue part is in the area.
local observer: Part = -- the green part
local subject: Part = -- the blue part
local vectorStartPointLocalSpaceOffsetFromObserver: Vector3 = .5 * observer.Size.Z * -Vector3.zAxis -- This is a guess based on the picture but you can change this.
local maxAngleDifference: number = math.rad(45)
local function isSubjectCenterInArea(): boolean
local vectorStartPoint: Vector3 = observer.CFrame * vectorStartPointLocalSpaceOffsetFromObserver
local vectorToSubject: Vector3 = subject.Position - vectorStartPoint
local horizontalVectorToSubject = vectorToSubject - vectorToSubject.Y * Vector3.yAxis
local horizontalGlobalWind: Vector3 = workspace.GlobalWind - workspace.GlobalWind.Y * Vector3.yAxis
local angleDifference: number = horizontalVectorToSubject:Angle(horizontalGlobalWind)
return angleDifference <= maxAngleDifference
end
Edit: I had accidentally written math.deg instead of math.rad.