Aeav
|
  |
| Joined: 29 Sep 2012 |
| Total Posts: 1155 |
|
|
| 07 Feb 2016 08:24 PM |
I want to make a thing where you have one part, let's say its size is 10,10,10.
I want to have smaller parts make up that shape, say 4, so 10/4 = 2.5. Each smaller part would have a size of 2.5,2.5,2.5? I think? I have no clue what to do after that. I'm positive you need to make a 'grid' for the part, and position them but I'm stuck. |
|
|
| Report Abuse |
|
|
| |
|
|
| 07 Feb 2016 08:55 PM |
for z = 0,10,2.5 do for y = 0,10,2.5 do for x = 0,10,2.5 do -- use instance.new() and position them at the x,y,z variables end end end
|
|
|
| Report Abuse |
|
|
Aeav
|
  |
| Joined: 29 Sep 2012 |
| Total Posts: 1155 |
|
|
| 08 Feb 2016 05:09 AM |
Ehh, that doesn't seem like a very effective way.
Also, to clarify I mean I want to fill a block with smaller blocks and have it take up the same shape/size/space as the previous block. |
|
|
| Report Abuse |
|
|
Aeav
|
  |
| Joined: 29 Sep 2012 |
| Total Posts: 1155 |
|
|
| 08 Feb 2016 05:19 AM |
I tried to make this, not knowing what to do, and it failed miserably. It just spawns in a crap ton of parts.
b = script.Parent bx = b.Size.X by = b.Size.Y bz = b.Size.Z n = 4
for a = 1, bx do for b = 1, by do for c = 1, bz do p = Instance.new('Part', workspace) p.Size = Vector3.new(bx/n, by/n, bz/n) p.CFrame = p.CFrame * CFrame.new(bx/n*2, by/n*2, bz/n*2) end end end |
|
|
| Report Abuse |
|
|
Aeav
|
  |
| Joined: 29 Sep 2012 |
| Total Posts: 1155 |
|
|
| 08 Feb 2016 05:21 AM |
Okay, this makes a huge block. It's not the same size as the 10x10x10 but it makes a huge block. It's an improvement.
b = script.Parent bx = b.Size.X by = b.Size.Y bz = b.Size.Z n = 4
for a = 1, bx do for b = 1, by do for c = 1, bz do p = Instance.new('Part', workspace) p.Size = Vector3.new(bx/n, by/n, bz/n) p.CFrame = p.CFrame * CFrame.new(bx/n+a, by/n+b, bz/n+c) end end end |
|
|
| Report Abuse |
|
|
Aeav
|
  |
| Joined: 29 Sep 2012 |
| Total Posts: 1155 |
|
| |
|
Aeav
|
  |
| Joined: 29 Sep 2012 |
| Total Posts: 1155 |
|
| |
|
Aeav
|
  |
| Joined: 29 Sep 2012 |
| Total Posts: 1155 |
|
|
| 08 Feb 2016 02:56 PM |
| Bump? I need to know how to split a block up into a number of parts and have those number of parts make up the same shape as the previous block. :) |
|
|
| Report Abuse |
|
|
Aeav
|
  |
| Joined: 29 Sep 2012 |
| Total Posts: 1155 |
|
| |
|
|
| 08 Feb 2016 04:37 PM |
Sorry it took so long, took a while to get my head around the maths:
parts = {}
w = 53 n = 8
z = w y = w/2 x = w/(n/2)
subPart = Instance.new('Part', workspace) subPart.Anchored = true subPart.Position = Vector3.new(0, 0, 0) subPart.Size = Vector3.new(x, y, z) table.insert(parts, subPart)
for i = 1, (n/2) - 1 do local part = Instance.new('Part', workspace) part.Anchored = true part.Size = Vector3.new(x, y, z) part.Position = Vector3.new(x*i, subPart.Position.y, subPart.Position.z) table.insert(parts, part) end
for _, v in pairs(parts) do local p = v:Clone() p.Position = Vector3.new(v.Position.x, v.Position.y + v.Size.y, v.Position.z) p.Anchored = true p.Parent = workspace end
|
|
|
| Report Abuse |
|
|
|
| 08 Feb 2016 04:37 PM |
w being width of the cube and n being the number of parts(keep even)
|
|
|
| Report Abuse |
|
|
|
| 09 Feb 2016 10:03 AM |
Cleaned it up a little, you can now change the position of the subPart:
parts = {}
w = 20 n = 6
z = w y = w/2 x = w/(n/2)
subPart = Instance.new('Part', workspace) subPart.Anchored = true subPart.Position = Vector3.new(0, 0, 0) subPart.Size = Vector3.new(x, y, z) table.insert(parts, subPart)
for i = 1, (n/2) - 1 do local part = Instance.new('Part', workspace) part.Anchored = true part.Size = Vector3.new(x, y, z) part.Position = Vector3.new(subPart.Position.x + x*i, subPart.Position.y, subPart.Position.z) table.insert(parts, part) end
for _, v in pairs(parts) do local p = v:Clone() p.Position = Vector3.new(v.Position.x, v.Position.y + v.Size.y, v.Position.z) p.Parent = workspace end
|
|
|
| Report Abuse |
|
|