generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: dividing parts?

Previous Thread :: Next Thread 
ehern11 is not online. 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
SheepOfIce is not online. SheepOfIce
Joined: 18 Jun 2010
Total Posts: 41
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 is not online. ehern11
Joined: 23 Apr 2011
Total Posts: 1541
20 Jun 2015 05:57 PM
ill try it out
Report Abuse
ChiefDelta is not online. ChiefDelta
Joined: 05 Nov 2010
Total Posts: 13071
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 is not online. ehern11
Joined: 23 Apr 2011
Total Posts: 1541
20 Jun 2015 06:10 PM
Thank you, i'll look for it.
Report Abuse
Jammer622 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image