I have some model, and they have random position, so I need to validate if the model is overlapped with another object (like player, car or also the same cloned model), but I can't figure out how to validate if the model is overlapped with another object, and validate is if that overlay is acceptable, because not all overlays are unacceptable.
You may be asking a very big question, but I'm a bit confused and I do not even know where to begin with this algorithm.
Any help would be appreciated.
Very accurately? You'll have to check every part in the model yourself. Generally? Use the functions Model:GetExtentsSize() and Model:GetModelCFrame() to create a relevant Region3 .
Like this:
wait(1) local model = workspace:WaitForChild('Model') --path to any model --model info local size = model:GetExtentsSize() local hsize = size/2 local pos = model:GetModelCFrame().p --parameters for region local lowp = pos - hsize local highp = pos + hsize local r3 = Region3.new(lowp,highp) --optional warning box local box = Instance.new('Part') box.BrickColor = BrickColor.new('Really red') box.Transparency=1 box.Anchored=true box.CanCollide=false box.CFrame = r3.CFrame box.Size = r3.Size box.Parent = workspace --creating a manual ignore list is useful local ignoreList = {} --igore parts in the model function fun(x) if x:IsA('BasePart') then table.insert(ignoreList,x) end end function scan(y) fun(y) for _,v in pairs(y:GetChildren()) do scan(v) end end scan(model) --ignore parts such as baseplate for _,v in pairs(workspace:GetChildren()) do if v:IsA('BasePart') then table.insert(ignoreList,v) end end --in example: while wait(1) do --most useful function! local parts = workspace:FindPartsInRegion3WithIgnoreList(r3,ignoreList,1000) if #parts>0 then box.Transparency=0.5 else box.Transparency=0.9 end end