janthran
|
  |
| Joined: 15 May 2009 |
| Total Posts: 17429 |
|
|
| 13 Sep 2013 02:06 PM |
| I've spent like the last hour scouring free models for a function to rotate a model. How do I do it with minimal lines of code? :/ |
|
|
| Report Abuse |
|
janthran
|
  |
| Joined: 15 May 2009 |
| Total Posts: 17429 |
|
| |
|
| 13 Sep 2013 02:35 PM |
| http://www.roblox.com/Rotate-Model-Function-item?id=58293017 |
|
|
| Report Abuse |
|
janthran
|
  |
| Joined: 15 May 2009 |
| Total Posts: 17429 |
|
|
| 13 Sep 2013 03:13 PM |
Thanks. Follow-up question: Is there a way to do GetChildren recursively? Like getchildren of a model in a model? |
|
|
| Report Abuse |
|
janthran
|
  |
| Joined: 15 May 2009 |
| Total Posts: 17429 |
|
|
| 13 Sep 2013 03:27 PM |
So I have this
tm=script.Parent
function rotatemodel(model,center,rotation) for i,v in ipairs(model:GetChildren()) do if v:IsA("Basepart") then v.CFrame=((CFrame.new(center)*rotation)*CFrame.new((v.Position-center)))*(v.CFrame-v.Position) elseif v:IsA("Model") then kids=v:GetChildren() rotatemodel(kids,tm.PivotPoint.Position,CFrame.Angles(math.pi/2,0,0)) end end end
rotatemodel(tm,tm.PivotPoint.Position,CFrame.Angles(math.pi/2,0,0))
Stack ending on line 8 with >Attempt to call global method "GetChildren" (A nil value)
or something like that. I closed the window |
|
|
| Report Abuse |
|