Detect Part Engulfing Raycast

Below is a summary of what i need, below that is my issue in detail.

  • I want to detect a part that the raycast starts in, so if partA is the origin, and partB completely covers partA to the point where the raycast starts inside partB but the origin is still partA, how would I immediately detect partB.

That’s the problem summed up. my actual problem is that I have an npc spawning around the player, and I got it successfully via:

Stalker:PivotTo(victimCharacter:GetPivot() * CFrame.new(math.random(-5, 5), -victimCharacter:GetPivot().LookVector, math.random(4,10)) - Vector3.new(0,.25,0)) --Position behind with some offset
Stalker.HumanoidRootPart.CFrame = CFrame.new(Stalker.HumanoidRootPart.Position, victimCharacter.HumanoidRootPart.Position) --LookAtPlayer
Stalker.HumanoidRootPart.Anchored = true --Anchor

However I now come to 2 issues at hand, one of which i can solve easily.
1.) NPC spawns around me but in the air(i can solve this via raycasting no biggie)
2.) NPC spawns around me but inside of parts(again raycasting if its multiple parts to just reposition again)

HOWEVER, i can’t reposition if it spawns inside a wall which it can’t detect, or if it somehow spawns above the void.

-my question is how would I get it to spawn either on top of the wall that it spawns in or better-case-scenario, outside the wall surface closest to the player?

raycasting direction equation:

local Direction = Stalker.HumanoidRootPart.CFrame.UpVector * -10