|
| 17 May 2014 09:54 PM |
| Does anyone have a SIMPLE and up-to-date working method to rotate models? |
|
|
| Report Abuse |
|
|
| |
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
| |
|
|
| 18 May 2014 01:01 AM |
What I know is that you would do:
model = game.Workspace.Model model:GetChildren() do
this is to get all of the parts in model, and for that you would also need to make sure that it is a part and not a script,decal,sound ect... |
|
|
| Report Abuse |
|
|
|
| 18 May 2014 01:19 AM |
| I know that but. Refer to the original question. |
|
|
| Report Abuse |
|
|
|
| 18 May 2014 01:50 AM |
| Have you tried the studio rotate? |
|
|
| Report Abuse |
|
|
|
| 18 May 2014 01:45 PM |
| Trying to do it from a script from in the game. |
|
|
| Report Abuse |
|
|
| |
|
Tynexx
|
  |
| Joined: 11 Jul 2012 |
| Total Posts: 1559 |
|
|
| 18 May 2014 02:50 PM |
model = game.Workspace.Model z = model:GetChildren() z.Rotation = Vector3.new(0,0,0)--change to rotation position try this |
|
|
| Report Abuse |
|
|
|
| 18 May 2014 02:58 PM |
function RotateModel(Model, Mid, Angles) for i, v in pairs(Model:GetChildren()) do if v:IsA("BasePart") then v.CFrame = Angles:toWorldSpace(Mid:toObjectSpace(v.CFrame)) end RotateModel(v, Mid, Angles) end end
local model = Workspace.Model --The model your rotating local mid = model:GetModelCFrame()
RotateModel(Model, mid, mid * CFrame.Angles(0, 0, 0)) -- mess with the 0,0,0 to get it to rotate |
|
|
| Report Abuse |
|
|
| |
|
alij12
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 1204 |
|
|
| 18 May 2014 03:26 PM |
>model = game.Workspace.Model >z = model:GetChildren() >z.Rotation = Vector3.new(0,0,0)--change to rotation position >try this
doing that will rotate each brick individually.
●▂▂● |
|
|
| Report Abuse |
|
|
|
| 18 May 2014 03:32 PM |
| http://www.roblox.com/function-RotateModel-item?id=20434280 |
|
|
| Report Abuse |
|
|
| |
|
|
| 18 May 2014 08:09 PM |
| Thanks warspy it worked. I have models inside models too how would i detect deeper into the hierarchy |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 18 May 2014 08:11 PM |
Recursion.
function getAll(par, tbl) for key, value in next, par:GetChildren() do if value:IsA("BasePart") then tbl[#tbl + 1] = value; end getAll(value); end return tb; end
function RotateModel(Model, Mid, Angles) local Model = getAll(Model, {}); for i, v in pairs(Model:GetChildren()) do if v:IsA("BasePart") then v.CFrame = Angles:toWorldSpace(Mid:toObjectSpace(v.CFrame)) end RotateModel(v, Mid, Angles) end end
Try that |
|
|
| Report Abuse |
|
|
klkljr
|
  |
| Joined: 14 Mar 2011 |
| Total Posts: 9823 |
|
|
| 18 May 2014 08:12 PM |
model = game.Workspace.Model i = model:GetChildren() while true do x = x + 1 i.Rotation = Vector3.new(x, 0, 0) wait() end
~egmen |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
|
| 18 May 2014 08:15 PM |
| Actually can anyone add on to WarSpy's to make rotate a whole listed tables of parts so I won't have to keep copying the script? |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 18 May 2014 08:17 PM |
function getAll(par, tbl) for key, value in next, par:GetChildren() do if value:IsA("BasePart") then tbl[#tbl + 1] = value; end getAll(value); end return tb; end
function RotateModel(Model, Mid, Angles) for i, v in pairs(Model:GetChildren()) do if v:IsA("BasePart") then v.CFrame = Angles:toWorldSpace(Mid:toObjectSpace(v.CFrame)) end RotateModel(v, Mid, Angles) end end
RotateModel(getAll(workspace), whatever, whatever); |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 18 May 2014 08:18 PM |
| And then replace Model:GetChildren() to just Model |
|
|
| Report Abuse |
|
|
| |
|
|
| 18 May 2014 08:23 PM |
Got some errors
line 17 toworldspace not valid member of model
and the the line you told me to take out get children |
|
|
| Report Abuse |
|
|