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: Rotate Model

Previous Thread :: Next Thread 
lego555444 is not online. lego555444
Joined: 21 Sep 2008
Total Posts: 1383
17 May 2014 09:54 PM
Does anyone have a SIMPLE and up-to-date working method to rotate models?
Report Abuse
lego555444 is not online. lego555444
Joined: 21 Sep 2008
Total Posts: 1383
17 May 2014 10:17 PM
B1
Report Abuse
lego555444 is not online. lego555444
Joined: 21 Sep 2008
Total Posts: 1383
17 May 2014 11:04 PM
B2
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
17 May 2014 11:21 PM
objectSpace
Report Abuse
lego555444 is not online. lego555444
Joined: 21 Sep 2008
Total Posts: 1383
17 May 2014 11:43 PM
A short script ?
Report Abuse
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
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
lego555444 is not online. lego555444
Joined: 21 Sep 2008
Total Posts: 1383
18 May 2014 01:19 AM
I know that but. Refer to the original question.
Report Abuse
indyracoon is not online. indyracoon
Joined: 12 Sep 2009
Total Posts: 6666
18 May 2014 01:50 AM
Have you tried the studio rotate?
Report Abuse
lego555444 is not online. lego555444
Joined: 21 Sep 2008
Total Posts: 1383
18 May 2014 01:45 PM
Trying to do it from a script from in the game.
Report Abuse
lego555444 is not online. lego555444
Joined: 21 Sep 2008
Total Posts: 1383
18 May 2014 02:48 PM
BUMP
Report Abuse
Tynexx is not online. 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
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
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
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
18 May 2014 03:25 PM
Did it work for you?
Report Abuse
alij12 is not online. 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
TheProgrammingMaster is not online. TheProgrammingMaster
Joined: 20 Aug 2011
Total Posts: 7602
18 May 2014 03:32 PM
http://www.roblox.com/function-RotateModel-item?id=20434280
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
18 May 2014 05:01 PM
@al Ike, I lol'd at that.
Report Abuse
lego555444 is not online. lego555444
Joined: 21 Sep 2008
Total Posts: 1383
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 is not online. 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 is not online. 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 is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
18 May 2014 08:13 PM
^ Not going to work
Report Abuse
lego555444 is not online. lego555444
Joined: 21 Sep 2008
Total Posts: 1383
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 is not online. 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 is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
18 May 2014 08:18 PM
And then replace Model:GetChildren() to just Model
Report Abuse
lego555444 is not online. lego555444
Joined: 21 Sep 2008
Total Posts: 1383
18 May 2014 08:20 PM
Thanks ill try it
Report Abuse
lego555444 is not online. lego555444
Joined: 21 Sep 2008
Total Posts: 1383
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
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