# How to check if 2 Vector3's intersect with eachother?

The title says it.

How would I check if two `Vector3` values intersect with each other? Note: I will not use raycasting since it is a vector and not a part, so don’t get confused.

I haven’t tried doing anything yet because I knew I was going to fail every time. I also didn’t find anything that suited my needs on the Roblox Developer Forum.

1 Like

Use both of Positions and use one of these ways

``````while wait() do
if workspace.Part.Position == workspace.Part2.Position then
print("Instersected")
end
end

``````

or

``````while wait() do
local magnitude = (workspace.Part.Position - workspace.Part2.Position).Magnitude

if magnitude <= 1 then -- Instead of 1, put whatever number you want
print("Instersected")
end
end
``````
2 Likes

EDIT
I have tried the answer given down below and it doesn’t work, when I run the code it doesn’t print anything, I don’t know why.

I recommend using a BoundingBox and then get a list of descendants, then check each descendant to see if it is a part and if it is a part then check the BoundingBox.
```–[[ When you run this code, if everything goes correctly, it should print “Intersected” ]]```
``` local bb = Instance.new(“Part”) bb.Name = “BoundingBox” bb.Size = Vector3.new(1,1,1) bb.Position = Vector3.new(0,0,0) bb.Anchored = true bb.CanCollide = false bb.BrickColor = BrickColor.new(“Really black”) bb.Parent = game.Workspace local part = Instance.new(“Part”) part.Size = Vector3.new(1,1,1) part.Position = Vector3.new(0,0,0) part.Anchored = true part.CanCollide = true part.BrickColor = BrickColor.new(“Really black”) part.Parent = game.Workspace local bbDescendants = bb:GetDescendants() ```
```for i,v in pairs(bbDescendants) do if v:IsA(“Part”) then if v.BoundingBox:Intersects(bb.BoundingBox) then print(“Intersected”) end end end ```