|
| 15 Jul 2013 11:13 AM |
I am trying to have a model rotate on its own, but there seems to be some problems.
Help?
brick = script.Parent.children.Rotation while true do wait(0.001) brick.CFrame = brick.CFrame * CFrame.fromEulerAnglesXYZ(1,0,0) end |
|
|
| Report Abuse |
|
|
| |
|
| |
|
baheeg
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 72846 |
|
| |
|
DrOMG
|
  |
| Joined: 21 Oct 2007 |
| Total Posts: 337 |
|
|
| 15 Jul 2013 11:22 AM |
| I just want to say that rotating a model is far more complicated than that, as far as I know, but I'd suggest making a primary part of the model controlled by a BodyGyro, meaning that the model would have to be Unanchored. |
|
|
| Report Abuse |
|
|
|
| 15 Jul 2013 11:22 AM |
Not a scripting genius, so I have no idea, but meh.
children are just CornerWedges
rotation is the rotation of the CornerWedges
I bet you will laugh at what I posted, thinking this guy is an idiot.
I get that a lot in SH.
|
|
|
| Report Abuse |
|
|
DrOMG
|
  |
| Joined: 21 Oct 2007 |
| Total Posts: 337 |
|
|
| 15 Jul 2013 12:30 PM |
You're not an idiot, you're asking for help without the correct foreknowledge.
If you ever get negative criticism, just take the constructive parts away from it. Ignore the insults, they mean what you want them to mean.
As for scripting, I'd consult tutorials and the ROBLOX wiki for answers. I only go to SH for help on a specific problem I can't find anywhere else.
You can't necessarily find the children of a model by saying: model.children It's an actual function which returns a table: model:GetChildren()
A table, in case you didn't know, is just a list of things. An example being: local table = {"cat", "bat", "sat"} print(table[2])
You'd receive "bat" in the output, as "bat" is the second part of the table. The same works for object values, as model:GetChildren() returns every object in the model.
Unfortunately, applying the same rotation to every object wouldn't work so well, as you'd just see every part in it's original spot pointing in another direction. I have no good idea on rotating a model, but my guess would be along the lines of:
local c = model:GetChildren() local base = c[1] local theta = 2*math.pi*(50/360) -- 50 Degrees to Radians conversion for i = 1, #c do local dis = (c[i].Position-base.Position).magnitude c[i].CFrame = CFrame.new(dis*math.cos(theta),0,dis*math.sin(theta))*CFrame.formEulerAnglesXYZ(0,theta,0) end
Yeah, I know it looks complicated. I also doubt it'd work but I was just playing around. Basically it takes one part, and bases the rotation around that one part with the circle equation. |
|
|
| Report Abuse |
|
|