|
| 26 Nov 2011 07:08 PM |
Title. If anyone knows how or can link me to a wiki page, then post away please.
#don't judge me |
|
|
| Report Abuse |
|
|
|
| 26 Nov 2011 07:09 PM |
model:GetModelCFrame()
-[::ƧѡÎḾḠΰῩ::]-[::Maker of stuff and Helper of Scripting::]- |
|
|
| Report Abuse |
|
|
|
| 27 Nov 2011 06:27 AM |
@swim
And I could move a brick to the model like this;
cf = model:GetModelCFrame() part.Position = Vector3.new(cf.x, cf.y, cf.z)
Correct?
#don't judge me |
|
|
| Report Abuse |
|
|
NXTBoy
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 4533 |
|
|
| 27 Nov 2011 06:40 AM |
| Not really. That will remove all rotation from the model. You'll want to use this (very old) script of mine: http://www.roblox.com/Model-CFraming-Script-item?id=21179422 |
|
|
| Report Abuse |
|
|
NXTBoy
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 4533 |
|
|
| 27 Nov 2011 06:44 AM |
That script is broken - that was pre `_G`-is-broken. Here's what you want:
getCFrame = function(object) if object:isA("BasePart") then return object.CFrame elseif object:isA("Model") and object.PrimaryPart then return getCFrame(object.PrimaryPart) else for _, obj in ipairs(object:getChildren()) do local cf = getCFrame(obj) if cf then return cf end end end end setCFrame = function(object, cframe) if object:isA("BasePart") then object.CFrame = cframe elseif object:isA("Model") then local center = getCFrame(object) if center == nil then return end local relativeCframes = {} for k, obj in ipairs(object:GetChildren()) do local cf = getCFrame(obj) if cf then relativeCframes[k] = center:inverse() * cf end end for k, obj in ipairs(object:GetChildren()) do setCFrame(obj, cframe * relativeCframes[k]) end end end _G.setCFrame = setCFrame _G.getCFrame = getCFrame |
|
|
| Report Abuse |
|
|
1WOOF1
|
  |
| Joined: 03 May 2009 |
| Total Posts: 20682 |
|
| |
|
NXTBoy
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 4533 |
|
|
| 27 Nov 2011 06:50 AM |
Isn't that the goal here?
setCFrame(workspace.MyModel, getCFrame(workspace.MyModel) * CFrame.new(50, 0, 0))
That would move the entire model (including submodels) 50 studs to the right/left |
|
|
| Report Abuse |
|
|
1WOOF1
|
  |
| Joined: 03 May 2009 |
| Total Posts: 20682 |
|
| |
|
NXTBoy
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 4533 |
|
| |
|
|
| 27 Nov 2011 07:21 AM |
lol
Thanks bros.
#don't judge me |
|
|
| Report Abuse |
|
|