HatHelper
|
  |
 |
| Joined: 02 Mar 2009 |
| Total Posts: 46305 |
|
|
| 10 Feb 2012 02:55 PM |
Model = script.Parent Floor = Model.Floor SizeX = Floor.Size.Z SizeZ = Floor.Size.X dents = math.random(9,10) get = Floor:getChildren() for i=1, #get do get[i]:remove() end print(Floor.CFrame:toEulerAnglesXYZ()) for i=1, dents do randomSize = Vector3.new(math.random(SizeX/5, SizeX/3), 1, math.random(SizeZ/5, SizeZ/3))
randomPosition = Vector3.new( math.random((-SizeX/2), SizeX/2), 0,
math.random((-SizeZ/2), SizeZ/2)
)
print(tostring(randomPosition)) dent = Instance.new("Part") dent.Name = "Dent" dent.Anchored = true
dent.formFactor = "Custom" dent.Size = randomSize dent.CFrame = Floor.CFrame + randomPosition dent.Parent = Floor
end
Almost at the end, at dent.CFrame=
I'm trying to make the part go at the same angle as the Floor. Basically I want square parts, dents, to come out of the Floor, without any going past the Floor borders, and I'm not sure how to do that with CFrame |
|
|
| Report Abuse |
|
|
joker922
|
  |
| Joined: 08 Jan 2010 |
| Total Posts: 1211 |
|
|
| 10 Feb 2012 02:59 PM |
| I'll test the script if I can fix it. |
|
|
| Report Abuse |
|
|
Spectrumw
|
  |
| Joined: 04 Aug 2009 |
| Total Posts: 13510 |
|
|
| 10 Feb 2012 03:01 PM |
dent.CFrame = Floor.CFrame * CFrame.new(0, (dent.Size.y / -2) + floor.Size.y, 0)
Is that what you are looking for? |
|
|
| Report Abuse |
|
|
HatHelper
|
  |
 |
| Joined: 02 Mar 2009 |
| Total Posts: 46305 |
|
| |
|
Spectrumw
|
  |
| Joined: 04 Aug 2009 |
| Total Posts: 13510 |
|
|
| 10 Feb 2012 03:05 PM |
| I'm not really sure what are you asking for x.x are you trying to make a part to come from the floor without make it 'hover'? If not, could you please elaborate? |
|
|
| Report Abuse |
|
|
HatHelper
|
  |
 |
| Joined: 02 Mar 2009 |
| Total Posts: 46305 |
|
|
| 10 Feb 2012 03:06 PM |
| Making squares go above the floor. If the floor is rotated, then the squares should be rotated so that if you were on the floor, and just looked down, you couldn't tell it was rotated. |
|
|
| Report Abuse |
|
|
joker922
|
  |
| Joined: 08 Jan 2010 |
| Total Posts: 1211 |
|
|
| 10 Feb 2012 03:31 PM |
| HatHelper, you script seems broken. |
|
|
| Report Abuse |
|
|
HatHelper
|
  |
 |
| Joined: 02 Mar 2009 |
| Total Posts: 46305 |
|
| |
|
| |
|
SDuke524
|
  |
| Joined: 29 Jul 2008 |
| Total Posts: 6267 |
|
|
| 10 Feb 2012 04:46 PM |
dent.CFrame=Floor.CFrame*CFrame.new(randomPosition)*CFrame.Angles(0,math.random(),0);
Like that? you can take out the last part if you want. |
|
|
| Report Abuse |
|
|
joker922
|
  |
| Joined: 08 Jan 2010 |
| Total Posts: 1211 |
|
|
| 10 Feb 2012 10:22 PM |
It just doesn't seem to work on the basics of the C-Frame Script.
Sorry. =/ |
|
|
| Report Abuse |
|
|
|
| 10 Feb 2012 11:25 PM |
Here's how I did it: parent = script.Parent Xstr = -math.floor(parent.Size.X/2) Ystr = -math.floor(parent.Size.Z/2) print(Xstr,Ystr) strpart = Instance.new("Part") strpart.Anchored = true strpart.FormFactor = "Plate" strpart.Shape = "Block" strpart.Size = Vector3.new(1,0.4,1) for x = Xstr,(-1 * Xstr) do for y = Ystr,(-1 * Ystr) do spclone = strpart:clone() spclone.CFrame = parent.CFrame * CFrame.new(x,0,y) spclone.Parent = workspace end end
The script's parent is a plate who's size is (5,0.4,5) Offcourse even if rotated, the bricks will still allign inside. |
|
|
| Report Abuse |
|
|
| |
|
HatHelper
|
  |
 |
| Joined: 02 Mar 2009 |
| Total Posts: 46305 |
|
| |
|