|
| 23 Apr 2014 04:14 PM |
The center point with be the geometric center of the parts, than it would CFrame them like 2 studs away from the center, like an explosion, but, not explody. Also I'm not to good with "return" it confuses me.
for _,part in pairs(script.Parent:GetChildren())do if part:IsA"Part" then What end end |
|
|
| Report Abuse |
|
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
| |
|
|
| 23 Apr 2014 04:17 PM |
The direction would be away from the center, Hard to explain so I used the explosion thing.
|
|
|
| Report Abuse |
|
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
|
| 23 Apr 2014 04:19 PM |
Gotcha:
centre = Vector3 dist = 2
for __,part in pairs(script.Parent:GetChildren())do if part:IsA"Part" then local dir = (centre - part.Position).Unit part.CFrame = part.CFrame + dir*dist end end |
|
|
| Report Abuse |
|
|
Bebee2
|
  |
| Joined: 17 May 2009 |
| Total Posts: 3985 |
|
|
| 23 Apr 2014 04:21 PM |
Your multiplying a number with a userdata...
And you don't multiply Vector3 values either... |
|
|
| Report Abuse |
|
|
Bebee2
|
  |
| Joined: 17 May 2009 |
| Total Posts: 3985 |
|
|
| 23 Apr 2014 04:22 PM |
Nuuuu...
*adds an e at the end of my first word of the last post* |
|
|
| Report Abuse |
|
|
|
| 23 Apr 2014 04:23 PM |
| I need help with getting the center.. |
|
|
| Report Abuse |
|
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
| |
|
| |
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
|
| 23 Apr 2014 04:30 PM |
Here you go thenL
centre = script.Parent:GetModelCFrame.p dist = 2
for _,part in pairs(script.Parent:GetChildren())do if part:IsA"Part" then local dir = (centre - part.Position).Unit part.CFrame = part.CFrame + dir*dist end end
@beebee, trust me. I have plenty of experience |
|
|
| Report Abuse |
|
|
|
| 23 Apr 2014 04:43 PM |
Thank you! Also, I was trying to make it move away from the center, depending how far from the center it is, but I've having troubles.
I have this perfect cube that's 6x6x6, and made with 1x1x1 bricks and hollow on the inside, whats happening is not all the bricks are moving away from it as the same as their reflected brick.
for __,part in pairs(script.Parent:GetChildren())do if part:IsA"Part" then part.CFrame = part.CFrame+(script.Parent:GetModelCFrame().p - part.Position).Unit*-(script.Parent:GetModelCFrame().p - part.Position).magnitude end end |
|
|
| Report Abuse |
|
|
|
| 23 Apr 2014 04:44 PM |
| If you cut the brick in half, the bricks are the same distance away from the center, after the function happens, they are not. |
|
|
| Report Abuse |
|
|
|
| 23 Apr 2014 04:44 PM |
| NEVER MIND. I KNOW WHATS UP. |
|
|
| Report Abuse |
|
|