kingmatt2
|
  |
| Joined: 20 Aug 2011 |
| Total Posts: 6494 |
|
|
| 16 Aug 2013 04:27 PM |
How? This is how you change the Vector3 posistion but I need to rotate it by the CFrame
script.Parent:MoveTo(Vector3.new(0,0,0))
How do I change the CFrame Rotation? |
|
|
| Report Abuse |
|
|
robomax11
|
  |
| Joined: 07 Jul 2011 |
| Total Posts: 6828 |
|
| |
|
kingmatt2
|
  |
| Joined: 20 Aug 2011 |
| Total Posts: 6494 |
|
| |
|
robomax11
|
  |
| Joined: 07 Jul 2011 |
| Total Posts: 6828 |
|
| |
|
|
| 16 Aug 2013 04:34 PM |
function CFrameModel(model, newcframe) for i,v in pairs(CFrameModel:GetChildren())do if v:IsA("BasePart") then v.CFrame = newcframe:ToWorldSpace(model:GetModelCFrame():ToObjectSpace(v.CFrame)) end CFrameModel(v, newcframe) end end
I think that might work.
|
|
|
| Report Abuse |
|
|
kingmatt2
|
  |
| Joined: 20 Aug 2011 |
| Total Posts: 6494 |
|
|
| 16 Aug 2013 04:36 PM |
| Dident do anything, no output. |
|
|
| Report Abuse |
|
|
|
| 16 Aug 2013 04:42 PM |
for i,v in pairs(CFrameModel:GetChildren())do
I meant model, not CFrameModel |
|
|
| Report Abuse |
|
|
kingmatt2
|
  |
| Joined: 20 Aug 2011 |
| Total Posts: 6494 |
|
| |
|
kingmatt2
|
  |
| Joined: 20 Aug 2011 |
| Total Posts: 6494 |
|
|
| 16 Aug 2013 04:53 PM |
Why did I say no one cares? Oh thats right! Wrong post. SORRY! |
|
|
| Report Abuse |
|
|
kingmatt2
|
  |
| Joined: 20 Aug 2011 |
| Total Posts: 6494 |
|
|
| 16 Aug 2013 04:56 PM |
Anyway thanks, But I dont know how I can edit it so while true do wait(1) --Code end
... Not the best scripter in the world. |
|
|
| Report Abuse |
|
|
|
| 16 Aug 2013 05:05 PM |
| CFrameModel(Workspace.Model, CFrame.new(0, 0, 0)) |
|
|
| Report Abuse |
|
|
kingmatt2
|
  |
| Joined: 20 Aug 2011 |
| Total Posts: 6494 |
|
| |
|
kingmatt2
|
  |
| Joined: 20 Aug 2011 |
| Total Posts: 6494 |
|
|
| 16 Aug 2013 05:12 PM |
ARG NOT WORKING.
function CFrameModel(model, newcframe) for i,v in pairs(model:GetChildren())do if v:IsA("BasePart") then v.CFrame = newcframe:ToWorldSpace(model:GetModelCFrame():ToObjectSpace(v.CFrame)) end CFrameModel(v, newcframe) end end while true do wait(.1) CFrameModel(script.Parent, CFrame.new(0, 0, 0)) end |
|
|
| Report Abuse |
|
|
|
| 16 Aug 2013 05:13 PM |
| That should just keep the model at CFrame.new(0, 0, 0) |
|
|
| Report Abuse |
|
|
kingmatt2
|
  |
| Joined: 20 Aug 2011 |
| Total Posts: 6494 |
|
|
| 16 Aug 2013 05:19 PM |
It dident move at all and it errored.. Forgot to tell you the output...
|
|
|
| Report Abuse |
|
|
kingmatt2
|
  |
| Joined: 20 Aug 2011 |
| Total Posts: 6494 |
|
|
| 16 Aug 2013 05:19 PM |
17:19:14.346 - ToWorldSpace is not a valid member 17:19:14.347 - Script "Workspace.Model.Script", Line 4 - global CFrameModel 17:19:14.348 - Script "Workspace.Model.Script", Line 11 17:19:14.348 - stack end
STupid foodcheck. |
|
|
| Report Abuse |
|
|
|
| 16 Aug 2013 05:22 PM |
toWorldSpace, toObjectSpace
Change those. |
|
|
| Report Abuse |
|
|
kingmatt2
|
  |
| Joined: 20 Aug 2011 |
| Total Posts: 6494 |
|
|
| 16 Aug 2013 05:29 PM |
Thank you all the way, but I still dont know how to only change the Rotation of the model not its Position..
This is what I have. CFrameModel(script.Parent, CFrame.new(0, 0, 0)*CFrame.Angles(0, math.pi,5))
This is what I thought but there was an error. Workspace.Model.Script:11: bad argument #1 to '?' (CFrame expected, got table)
CFrameModel(script.Parent, CFrame * CFrame.new(0,0,0)*CFrame.Angles(0, math.pi,5)) |
|
|
| Report Abuse |
|
|
|
| 16 Aug 2013 05:50 PM |
| lol u still have not found the answer? i have the answer lol 1sec i get it from my game :3 |
|
|
| Report Abuse |
|
|
|
| 16 Aug 2013 05:54 PM |
function TransformModel(objects, center, new, recurse) for _,object in pairs(objects) do if object:IsA("Part") then object.CFrame = new:toWorldSpace(center:toObjectSpace(object.CFrame)) end if recurse then TransformModel(object:GetChildren(), center, new, true) end end end
while true do local center = script.Parent.Parent:GetModelCFrame() TransformModel( script.Parent:GetChildren(), -- model you want to rotate lol center, center * CFrame.Angles(0,math.rad(1),0), -- how much you want to rotate in true ) wait(0.05) end
lol you only need to edit the 2nd half, for the rotation use math.rad(degrees) i used 1 because i made the wait 0.05, i wanted a smooth spinning motion...
also this is on a while true do loop so u might need to remove that if you dont need it and remove the end at the end lol and the wait(0.05) of course. |
|
|
| Report Abuse |
|
|
kingmatt2
|
  |
| Joined: 20 Aug 2011 |
| Total Posts: 6494 |
|
|
| 16 Aug 2013 05:55 PM |
| THANK YOU!!!!!!!!!!!!!!!!!!!!!!!!!!! |
|
|
| Report Abuse |
|
|
| |
|