Camera:GetPartsObscuringTarget
This method returns an array of BaseParts that are obscuring the lines of sight between the camera's CFrame and Vector3 positions in the castPoints array. Any Instances included in the ignoreList array will be ignored, along with their descendants.
The castPoints parameter is given as an array of Vector3 positions. Note that the array of BaseParts returned is in an arbitrary order, and no additional raycast data is provided. If you need data such as hit position, hit material, or surface normal, you should opt for the WorldRoot:Raycast() method.
local Workspace = game:GetService("Workspace")local camera = Workspace.CurrentCameralocal castPoints = {Vector3.new(0, 10, 0),Vector3.new(0, 15, 0)}local ignoreList = {}local partsObscuringTarget = camera:GetPartsObscuringTarget(castPoints, ignoreList)
If Terrain obscures a cast point, BaseParts obscuring the cast point between the obscuring Terrain and the cast point will not be returned.
Parameters
An array of Instances that should be ignored, along with their descendants.