How can I detect if 2 nocollide parts are touching each other

Effectively what the title says
More accurately can I check if part1 is inside part2 at a given moment if they are both nocollide

Weird, i thought the Touched event would still work even if it was non collide, well either way i suppose you can use WorldRoot:GetPartsInPart() or BasePart:GetTouchingParts()?

There is function primarily for that.
ArePartsTouchingOther

1 Like

Can you provide the syntax? The documentation is confusing me

Thinking about that yes, i suggest following @mniao suggestions

local Params = OverlapParams.new()
Params.FilterDescendantsInstances = {TheOtherPart}
Params.FilterType = Enum.RaycastFilterType.Whitelist

local list = workspace:GetPartsInPart(YourPart,Params)

if table.find(list,TheOtherPart) then
-- they are touching
end

(ups edit my post)

2 Likes

Wouldn’t that check if part1 is touching any part not just part2
Or does it only check with other parts inside the table?

I’m reading the documentation and it seems it does indeed check for any part.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.