How could I see a part through another part?

And how could I make a raycast see both parts, but priorities the extra visible one?
Just like this:

Thanks!

2 Likes

Only way I can think is to wrap it in surface Guis and set them to AlwaysOnTop

image

image

image

You need to temporarily blacklist them using raycast params and just remove them out the blacklist in the order that you want it to detect them. Hope this helps!

Do what @deluxor said, and for visibility, i recommend you use “Highlight” objects, although GUI gives you the ability to customize sides to your own liking, a highlight is way more efficient, and from the style of your game, i can say its a safe choice for visibility. Hope this helps

1 Like
local function PrioritizedRaycast(origin, direction, priorityPart)
    local raycastParams = RaycastParams.new()
    raycastParams.FilterType = Enum.RaycastFilterType.Blacklist

    local result = workspace:Raycast(origin, direction)
    if not result then return nil end
    if result.Instance == priorityPart then return result end

    raycastParams.FilterDescendantsInstances = {result.Instance}
    local secondResult = workspace:Raycast(origin, direction, raycastParams)
    return secondResult or result
end
1 Like

Forgot Blacklist was deprecated. I think you can use .Exclude instead

1 Like

Doesn’t highlight have a limit of 30 objects? Thanks!

Edit: I can just have them share a parent, and highlight adornee the parent :p