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: Preferred methood?

Previous Thread :: Next Thread 
hithere4994 is not online. hithere4994
Joined: 25 Sep 2010
Total Posts: 2459
27 Jul 2011 04:18 PM
I have a model that I want to arrange multiple of in a circle around a center brick. Is there any function or the likes that would be more efficient than CFraming it by hand?
Report Abuse
RBXSummerDay is not online. RBXSummerDay
Joined: 07 Oct 2010
Total Posts: 99
27 Jul 2011 04:29 PM
Yes, there is.


local CenterPt = Vector3.new(0,0,0)
local radius = 10
local models = {
Workspace.Model1,
Workspace.Model2,
}
local numModels = #models
local i = 0
local PositionC = coroutine.create(function(model)
model:MoveTo(Vector3.new(math.cos(i*(2*math.pi/numModels))*radius*math.pi, 0, math.sin(i*(2*math.pi/numModels))*radius*math.pi) + CenterPt)
i = i + 1
end)

for _, v in pairs(models) do
coroutine.resume(PositionC, v)
end




Try that. It MIGHT not work as desired... My math may be a bit off.
Report Abuse
citymaster22 is not online. citymaster22
Joined: 10 Jan 2010
Total Posts: 4993
27 Jul 2011 04:30 PM
I'm pretty sure you're an alt :P
Report Abuse
hithere4994 is not online. hithere4994
Joined: 25 Sep 2010
Total Posts: 2459
27 Jul 2011 04:36 PM
@RBX, how far apart does it make the models?
Report Abuse
hithere4994 is not online. hithere4994
Joined: 25 Sep 2010
Total Posts: 2459
27 Jul 2011 04:45 PM
Output is saying "Script "Workspace.Script" Line 4" and then "Stack end"
Report Abuse
chikenugget is not online. chikenugget
Joined: 09 May 2009
Total Posts: 2552
27 Jul 2011 04:49 PM
Tag your models that need to be arranged in a circle.
Report Abuse
hithere4994 is not online. hithere4994
Joined: 25 Sep 2010
Total Posts: 2459
27 Jul 2011 04:58 PM
I added another end to see if that would solve and it said "'eof expected near "end"
Report Abuse
chikenugget is not online. chikenugget
Joined: 09 May 2009
Total Posts: 2552
27 Jul 2011 05:01 PM
...
Report Abuse
killjoy37 is not online. killjoy37
Joined: 27 Aug 2008
Total Posts: 2821
27 Jul 2011 05:08 PM
Instead of

local models = {
Workspace.Model1,
Workspace.Model2,
}

Try

local models = {Workspace.Model1, Workspace.Model2, Workspace.Model3}
Report Abuse
hithere4994 is not online. hithere4994
Joined: 25 Sep 2010
Total Posts: 2459
27 Jul 2011 05:29 PM
It says it's running, but it's not doing anything.
Report Abuse
hithere4994 is not online. hithere4994
Joined: 25 Sep 2010
Total Posts: 2459
27 Jul 2011 06:44 PM
*bump*
Report Abuse
RBXSummerDay is not online. RBXSummerDay
Joined: 07 Oct 2010
Total Posts: 99
27 Jul 2011 06:46 PM
What exactly is happening? Try adding some print lines to pinpoint the location of the error.


@citymaster

What makes you say that?
Report Abuse
hithere4994 is not online. hithere4994
Joined: 25 Sep 2010
Total Posts: 2459
27 Jul 2011 06:50 PM
With one print after each line with the number of the line above, output reads:

1
2
3
4
5
9
10
6
7
8
11
10
11
10
11
10
11
10
11
10
11
10
11
10
11
10
11
10
11
10
11
10
11
10
11
10
11
10
11
10
11
Report Abuse
RBXSummerDay is not online. RBXSummerDay
Joined: 07 Oct 2010
Total Posts: 99
27 Jul 2011 07:05 PM
DUH...
Forgot to make the coroutine loop infinitely...
The coroutine 'dies' when we previously resumed it since there was no loop. After a coroutine dies, it cannot be resumed again. If we have a continuous loop, we should be fine.
We also have to change the code around a little bit because of this loop.



local CenterPt = Vector3.new(0,0,0)
local radius = 10
local models = {
Workspace.Model1,
Workspace.Model2,
}
local numModels = #models
local i = 1
local PositionC = coroutine.create(function(Models)
while true do
local model = Models[i]
model:MoveTo(Vector3.new(math.cos(i*(2*math.pi/numModels))*radius*math.pi, 0, math.sin(i*(2*math.pi/numModels))*radius*math.pi) + CenterPt)
i = i + 1
coroutine.yield()
end
end)

for _, v in pairs(models) do
coroutine.resume(PositionC, models)
end
Report Abuse
hithere4994 is not online. hithere4994
Joined: 25 Sep 2010
Total Posts: 2459
27 Jul 2011 07:10 PM
Still not working :\

1
2
3
4
5
13
14
6
7
8
9
10
15
14
11
7
8
9
10
15
14
11
7
8
9
10
15
14
11
7
8
9
10
15
14
11
7
8
9
10
15
14
11
7
8
9
10
15
14
11
7
8
9
10
15
14
11
7
8
9
10
15
14
11
7
8
9
10
15
14
11
7
8
9
10
15
14
11
7
8
9
10
15
14
11
7
8
9
10
15
14
11
7
8
9
10
15
14
11
7
8
9
10
15
14
11
7
8
9
10
15
14
11
7
8
9
10
15
Report Abuse
RBXSummerDay is not online. RBXSummerDay
Joined: 07 Oct 2010
Total Posts: 99
27 Jul 2011 07:12 PM
It's going through every model...
Is there space for the model in these locations around the center point? Try looking above your desired center point.

The math, of course, may also be wrong.
Report Abuse
RBXSummerDay is not online. RBXSummerDay
Joined: 07 Oct 2010
Total Posts: 99
27 Jul 2011 07:14 PM
I just tested it with 6 models. It puts the models in a circle around the center point (at congruent angles from each other, as planned). I'm not sure why it isn't working for you.
Report Abuse
hithere4994 is not online. hithere4994
Joined: 25 Sep 2010
Total Posts: 2459
27 Jul 2011 07:15 PM
I have tried changing the location of the center brick
Report Abuse
hithere4994 is not online. hithere4994
Joined: 25 Sep 2010
Total Posts: 2459
27 Jul 2011 07:16 PM
Wait, found the problem. I put the models in the Lighting *durp*
Report Abuse
RBXSummerDay is not online. RBXSummerDay
Joined: 07 Oct 2010
Total Posts: 99
27 Jul 2011 07:17 PM
Can you post your version of the script, then?
Report Abuse
RBXSummerDay is not online. RBXSummerDay
Joined: 07 Oct 2010
Total Posts: 99
27 Jul 2011 07:18 PM
Ah, late post.
Glad you found the problem. ^_^
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