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 |
|
|
|
| 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
|
  |
| Joined: 02 Apr 2008 |
| Total Posts: 467 |
|
| |
|
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 |
|
|
|
| 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
|
  |
| 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
|
  |
| Joined: 02 Apr 2008 |
| Total Posts: 467 |
|
| |
|
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 |
|
|
|
| 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
|
  |
| Joined: 02 Apr 2008 |
| Total Posts: 467 |
|
|
| 29 Aug 2013 10:39 AM |
| BodyAngularVelocity works perfectly, thanks |
|
|
| Report Abuse |
|
|