ehern11
|
  |
| Joined: 23 Apr 2011 |
| Total Posts: 1541 |
|
|
| 20 Jun 2015 05:28 PM |
| so lets say I have a 20x20 (x,z) part. After 2 seconds, I want the block to be divided into 4 different 10x10 (x,z) parts. How can I do this? |
|
|
| Report Abuse |
|
|
|
| 20 Jun 2015 05:43 PM |
You can first destroy the original Part. Then, assuming the Part's XZ Position is (0, 0), create 4 new Parts with a XZ Position of (5, 5), (-5, 5), (-5, -5), and (5, -5). In general, the Position of the new Parts can be calculated by:
X = parentPosition.X ± Size.X/2.0 Z = parentPosition.Z ± Size.Z/2.0
Where parentPosition is the large block's Position before it is split. |
|
|
| Report Abuse |
|
|
ehern11
|
  |
| Joined: 23 Apr 2011 |
| Total Posts: 1541 |
|
| |
|
|
| 20 Jun 2015 06:01 PM |
| If you want to look at some source code for this, someone somewhere (was it stravant?) made a plugin for (roughly) this. I don't remember anything else. |
|
|
| Report Abuse |
|
|
ehern11
|
  |
| Joined: 23 Apr 2011 |
| Total Posts: 1541 |
|
|
| 20 Jun 2015 06:10 PM |
| Thank you, i'll look for it. |
|
|
| Report Abuse |
|
|
Jammer622
|
  |
| Joined: 19 Nov 2008 |
| Total Posts: 1739 |
|
|
| 20 Jun 2015 06:30 PM |
I recently re-learned finding relative positions of parts. You might find this useful.
local p = Workspace.Part local p1 = p:Clone() p1.FormFactor = "Custom" p1.Size = Vector3.new(p.Size.X / 2, p.Size.Y, p.Size.Z / 2) local p2, p3, p4 = p1:Clone(), p1:Clone(), p1:Clone() p1.Position = p.CFrame * Vector3.new(p.Size.X / 4, 0, p.Size.Z / 4) p2.Position = p.CFrame * Vector3.new(p.Size.X / 4, 0, -p.Size.Z / 4) p3.Position = p.CFrame * Vector3.new(-p.Size.X / 4, 0, p.Size.Z / 4) p4.Position = p.CFrame * Vector3.new(-p.Size.X / 4, 0, -p.Size.Z / 4) p1.Parent = p.Parent p2.Parent = p.Parent p3.Parent = p.Parent p4.Parent = p.Parent p:Remove()
It'll keep the rotation of the part and split the X and Z axis into halves. If you eventually want the Y axis split too, just follow the pattern. |
|
|
| Report Abuse |
|
|