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
 

Rotating a Model

Previous Thread :: Next Thread 
Hagar5000 is not online. Hagar5000
Joined: 02 Apr 2008
Total Posts: 467
29 Aug 2013 09:36 AM
I know you can move and CFrame models using MoveTo() and stuff, but what would be the easiest way of rotating a model using a script?
Report Abuse
DragonODeath is not online. DragonODeath
Joined: 02 May 2011
Total Posts: 1252
29 Aug 2013 09:43 AM
Make a brick. Position it using the :GetModelCFrame() method to get the center of the model. Then weld everything to the brick, rotate the brick itself, then destroy the brick.
Report Abuse
Hagar5000 is not online. Hagar5000
Joined: 02 Apr 2008
Total Posts: 467
29 Aug 2013 09:44 AM
Sounds good, Ill try that
Report Abuse
Hagar5000 is not online. Hagar5000
Joined: 02 Apr 2008
Total Posts: 467
29 Aug 2013 10:14 AM
I tried that, but when I rotate the new center brick, none of the bricks welded to it move at all. Am I doing the welds wrong? Im using this,

local function weldBetween(a, b)
local weld = Instance.new("ManualWeld")
weld.Part0 = a
weld.Part1 = b
weld.C0 = CFrame.new()
weld.C1 = b.CFrame:inverse() * a.CFrame
weld.Parent = a
return weld;
end

And all the bricks that arent the center are unanchored while it rotates. I tried unanchoring the center as well, same thing happened.
Report Abuse
Unsubstantial is not online. Unsubstantial
Joined: 11 Sep 2012
Total Posts: 872
29 Aug 2013 10:26 AM
It should work correctly if you're using a BodyGyro or BodyAngularVelocity. If you're using CFrame to rotate the brick, then that is why.
Report Abuse
Hagar5000 is not online. Hagar5000
Joined: 02 Apr 2008
Total Posts: 467
29 Aug 2013 10:26 AM
Or maybe Im rotating the center brick incorrectly. Is this right?

Reference.CFrame = CFrame.new(Reference.Position) * CFrame.Angles(0, math.pi/4, 0)
Report Abuse
Hagar5000 is not online. Hagar5000
Joined: 02 Apr 2008
Total Posts: 467
29 Aug 2013 10:26 AM
Yeah that's it
Report Abuse
ExosXguy is not online. ExosXguy
Joined: 10 Oct 2010
Total Posts: 2239
29 Aug 2013 10:27 AM
I think moving a welded brick via cframe doesn't move the other welded bricks with it.
Report Abuse
Unsubstantial is not online. Unsubstantial
Joined: 11 Sep 2012
Total Posts: 872
29 Aug 2013 10:29 AM
Moving a brick with CFrame updates the welds attached to it, so the other bricks will remain where they are. I strongly suggest you use a BodyGyro.
Report Abuse
Hagar5000 is not online. Hagar5000
Joined: 02 Apr 2008
Total Posts: 467
29 Aug 2013 10:39 AM
BodyAngularVelocity works perfectly, thanks
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