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: How to rotate a model using a script?

Previous Thread :: Next Thread 
idyllically is not online. idyllically
Joined: 13 Mar 2010
Total Posts: 4622
19 Mar 2014 12:29 PM
I built a diamond-like shape. How would I rotate it?

Outfoxing Foxes
Report Abuse
extremeninjamaster is not online. extremeninjamaster
Joined: 25 Feb 2012
Total Posts: 2570
19 Mar 2014 12:30 PM
If it's a model just choose the rotate tool in the toolbar...
Report Abuse
VerifiedName is not online. VerifiedName
Joined: 26 Jul 2009
Total Posts: 4534
19 Mar 2014 12:31 PM
Out ^

#nerdsunited
Report Abuse
idyllically is not online. idyllically
Joined: 13 Mar 2010
Total Posts: 4622
19 Mar 2014 12:32 PM
I need it to automatically rotate in-game.

Outfoxing Foxes
Report Abuse
extremeninjamaster is not online. extremeninjamaster
Joined: 25 Feb 2012
Total Posts: 2570
19 Mar 2014 12:33 PM
What can't you use the rotate tool to rotate things..?

Big surprise if you can't
Report Abuse
idyllically is not online. idyllically
Joined: 13 Mar 2010
Total Posts: 4622
19 Mar 2014 12:35 PM
I can use the rotate tool. I rotate things all the time in studio. I need it to spin while I'm not there. In a server. In-game. Without me doing anything. You know what I mean? A script that makes a model spin forever.

Outfoxing Foxes
Report Abuse
VerifiedName is not online. VerifiedName
Joined: 26 Jul 2009
Total Posts: 4534
19 Mar 2014 12:36 PM
@Extreme, you're a dumbass.

@OP, found this on another forum post. Maybe it'll work maybe it won't.

rotation=true parts=workspace.Model1:GetChildren() for i=1,#parts do if parts[i]:IsA("BasePart") then parts[i].CFrame=parts[i].CFrame+Vector3.new(0,0,0) if rotation==true then parts[i].CFrame=CFrame.fromEulerAnglesXYZ(0,0,0) * parts[i].CFrame else end end end

#nerdsunited
Report Abuse
idyllically is not online. idyllically
Joined: 13 Mar 2010
Total Posts: 4622
19 Mar 2014 12:41 PM
@Verified, it had no effect. Thanks for the attempt, though.

Outfoxing Foxes
Report Abuse
transIate is not online. transIate
Joined: 20 Jun 2013
Total Posts: 2699
19 Mar 2014 12:42 PM
lol @verified
Report Abuse
UnStunned is not online. UnStunned
Joined: 14 Jun 2012
Total Posts: 122
19 Mar 2014 12:49 PM
You can't rotate models
Models do not have CFrame,rotation,size properties.
Report Abuse
idyllically is not online. idyllically
Joined: 13 Mar 2010
Total Posts: 4622
19 Mar 2014 12:51 PM
I know that they don't have those properties, so I figured there'd be a script that moves all of the children around a certain point. Which sounds pretty challenging to make.

Outfoxing Foxes
Report Abuse
transIate is not online. transIate
Joined: 20 Jun 2013
Total Posts: 2699
19 Mar 2014 12:57 PM
just use :moveTo() if ur moving it in a diff position lol
Report Abuse
idyllically is not online. idyllically
Joined: 13 Mar 2010
Total Posts: 4622
19 Mar 2014 12:59 PM
I'm not, but thanks for the attempt.

Outfoxing Foxes
Report Abuse
jrf2112 is not online. jrf2112
Joined: 29 Jun 2008
Total Posts: 3354
19 Mar 2014 01:06 PM
function rotateMod(mod,center,rotation)
local parts ={}
local function scan(parent)
for _,obj in pairs(parent:GetChildren()) do
if (obj:IsA("BasePart")) then
table.insert(parts,obj)
end
scan(obj)
end
end
scan(mod)
for _,part in pairs(parts) do
part.CFrame = (center*rotation*(center:inverse()*part.CFrame)) -- Credit to oysi93 for this equation thing
end
end

--[[

rotateMod(mod Model, center CFrame, rotation CFrame)

Example:
rotateMod(model, model:GetModelCFrame(), CFrame.Angles(0,math.rad(2),0)


Example:

local mod = game.Workspace.MODEL
local step = 1
for i = 0,360,step do
rotateMod(mod,mod:GetModelCFrame(),CFrame.Angles(0,math.rad(step),0))
wait()
end

]]
Report Abuse
idyllically is not online. idyllically
Joined: 13 Mar 2010
Total Posts: 4622
19 Mar 2014 01:15 PM
@Jrf, it works! Now I just have to do is make it rotate the correct way...

Outfoxing Foxes
Report Abuse
idyllically is not online. idyllically
Joined: 13 Mar 2010
Total Posts: 4622
19 Mar 2014 01:17 PM
Took no time at all to make it rotate correctly. Thanks!

Outfoxing Foxes
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