FootBa11
|
  |
| Joined: 16 Sep 2008 |
| Total Posts: 11501 |
|
|
| 04 Dec 2013 09:23 PM |
I have this script I engineered for SB. Its designed to grow trees. It works fine, but the problem is that it spawns trees at the ground, but then shoots them up into the air.
It is anchored. The problem is that when it re-configures the size and position of the bricks, it tries to put them on top of each other, resulting in the blocks moving up into the air. How do I avoid this error?
while true do m = Instance.new("Model") m.Parent = game.Workspace m.Name = "Tree" t = Instance.new("Part") t.BrickColor = BrickColor.new("Brown") t.Anchored = true t.Size = Vector3.new(2,1,2) t.CFrame = CFrame.new(math.random(-800,800),0,math.random(-800,800)) t.Parent = m l = Instance.new("Part") l.BrickColor = BrickColor.new("Bright green") l.Anchored = true l.Parent = m l.Size = Vector3.new(1,1,1) for i = 1,10 do t.Size = Vector3.new(2,i,2) l.CFrame = t.CFrame + Vector3.new(0,(t.Size.y/3),0) l.Size = Vector3.new(i,i,i) wait() end wait() end |
|
|
| Report Abuse |
|
|
|
| 04 Dec 2013 09:24 PM |
| Assign CFrame after Adjusting the size. |
|
|
| Report Abuse |
|
|
FootBa11
|
  |
| Joined: 16 Sep 2008 |
| Total Posts: 11501 |
|
|
| 04 Dec 2013 09:26 PM |
How?
It rndomly assigns the cframe.
How would I keep it in a fixed position without it jumping all over the place? |
|
|
| Report Abuse |
|
|
|
| 04 Dec 2013 09:28 PM |
| In the script make it change the size before assigning C-Frame. |
|
|
| Report Abuse |
|
|
|
| 04 Dec 2013 09:30 PM |
| This probably doesn't make a difference but make the parent in lighting and at the end put it back in workspace. it will do a little flash I guess but I'mpretty sure most games have flashes c: |
|
|
| Report Abuse |
|
|
FootBa11
|
  |
| Joined: 16 Sep 2008 |
| Total Posts: 11501 |
|
|
| 04 Dec 2013 09:31 PM |
If I understand you correctly, you mean for me to put this line:
t.CFrame = CFrame.new(math.random(-800,800),0,math.random(-800,800))
After this: for i = 1,10 do OTHER THINGS wait() end
is that correct?
Because if it is then it will just grow from the origin and then move to a random position. |
|
|
| Report Abuse |
|
|
|
| 04 Dec 2013 09:34 PM |
Just change it so every time you use:
i.Size = something
you have to do
i.CFrame = something
to reposition it correctly.
Otherwise it's using roblox's collision engine to see where to put is so it doesnt overlap anything. |
|
|
| Report Abuse |
|
|
FootBa11
|
  |
| Joined: 16 Sep 2008 |
| Total Posts: 11501 |
|
|
| 04 Dec 2013 09:43 PM |
Is there any way I can force it to overlap? Like, if a tree spawns to close to another I dont want them to be on top of each other, I want them to be inside each other. |
|
|
| Report Abuse |
|
|
FootBa11
|
  |
| Joined: 16 Sep 2008 |
| Total Posts: 11501 |
|
| |
|