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 » Scripting Helpers
Home Search
 

Re: CFrame help

Previous Thread :: Next Thread 
HatHelper is not online. HatHelper
Top 25 Poster
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 is not online. 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 is not online. 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 is not online. HatHelper
Top 25 Poster
Joined: 02 Mar 2009
Total Posts: 46305
10 Feb 2012 03:03 PM
No
Report Abuse
Spectrumw is not online. 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 is not online. HatHelper
Top 25 Poster
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 is not online. joker922
Joined: 08 Jan 2010
Total Posts: 1211
10 Feb 2012 03:31 PM
HatHelper, you script seems broken.
Report Abuse
HatHelper is not online. HatHelper
Top 25 Poster
Joined: 02 Mar 2009
Total Posts: 46305
10 Feb 2012 03:37 PM
OBVIOUSLY.
Report Abuse
rossb654mail is not online. rossb654mail
Joined: 12 Oct 2009
Total Posts: 11004
10 Feb 2012 03:44 PM
^
Report Abuse
SDuke524 is not online. 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 is not online. 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
MasterAnimation200 is not online. MasterAnimation200
Joined: 25 May 2008
Total Posts: 1451
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
LuisPambid is not online. LuisPambid
Joined: 31 Mar 2011
Total Posts: 532
11 Feb 2012 12:17 AM
Output?
Report Abuse
HatHelper is not online. HatHelper
Top 25 Poster
Joined: 02 Mar 2009
Total Posts: 46305
11 Feb 2012 09:57 AM
Thanks SDuke
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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