Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I get all of the parts within a given radius?

Asked by
Minifig77 190
9 years ago

What I want to do is retrieve all of the parts within a given three dimensional radius in a table. For example, a large ball has a size of 500, 500, 500. I want to get any part that would be inside of the ball.

I've heard that there's a way to do this with magnitude, but how?

1 answer

Log in to vote
1
Answered by 9 years ago

wait(10) local brick = script.Parent local mofos = game.Workspace:GetChildren() local TheDit = 20 for i,v in pairs(mofos) do if v:IsA("Part") or v:IsA("WedgePart") or v:IsA("CornerWedgePart") then

if ((brick.Position - v.Position).magnitude<TheDit) then print(v) else end end end

0
im noob dont hate XxKillerHumanxX 0 — 9y
Ad

Answer this question