Spreading parts out without positioning them extremely far from 0,0,0

My apologies if the title was worded weird.

I am getting coordinates of road points from openstreetmap. Unfortunately, setting parts to the location of these coordinates causes them to be way too close together. For example:


The above image is a very large amount of parts very close together.

Multiplying the coordinates by 10000 spaces them at a good distance apart, but also puts them extremely far away from the baseplate, from 0,0,0. For example:

How would I be able to space the parts like the above picture, but keeping them close to 0,0,0?
I’m sure it is probably pretty simple math, so I apologize if I am missing a very simple solution.

Not really sure I understand your question, but I think your asking how to position a lot of parts near to a certain point, but not in an exact spot. Here’s what I would do in your case:

local Parts = game.Workspace.Parts:GetChildren()
-- Change this to your parts

for _, part in pairs(Parts) do
 
-- Picking random coordinates
local XAxis = math.Random(-10, 10)
local YAxis = math.Random(-10, 10)
local ZAxis = math.Random(-10, 10)

part.Position = Vector3.new(XAxis, YAxis, ZAxis)
end

Sorry if this wasn’t your question.

If you want to move the parts to 0, 0, 0 then I may have an idea.

You can make a model, put all the parts in the model, call :MoveTo() on the model to 0, 0, 0 so the parts can be moved there, then parent the parts back to workspace, rather than the model, then destroy the model.

local model = Instance.new("Model")
model.Parent = workspace
local parts = [Insert a table of parts to move here]

for index, part in pairs(parts) do
    part.Parent = model
end

model:MoveTo(Vector3.new(0, 0, 0)

for index, part in pairs(parts) do
    part.Parent = workspace
end

model:Destroy()

I think this is how it would go, I’m not sure, but why not give it a try?

1 Like

great idea, and it works! I actually found it useful to keep the model, so it’s a great solution. Thanks!