|
| 12 Jan 2015 11:58 AM |
I'm currently doing the following:
local Book = game.ReplicatedStorage.Book local BRWeld = Instance.new("ManualWeld") BRWeld.Parent = Book BRWeld.Part0 = Book.BackLeft BRWeld.Part1 = Book.BackRight BRWeld.C0 = CFrame.new(0, 0, 0)
local PLWeld = Instance.new("ManualWeld") PLWeld.Parent = Book PLWeld.Part0 = Book.BackLeft PLWeld.Part1 = Book.PageLeft PLWeld.C0 = CFrame.new(0, 0, 0)
local PRWeld = Instance.new("ManualWeld") PRWeld.Parent = Book PRWeld.Part0 = Book.BackLeft PRWeld.Part1 = Book.PageRight PRWeld.C0 = CFrame.new(0, 0, 0)
To get my book of 4 parts to be welded together. What I want to know is whether there is an easier way than to have to individually weld each part as models can be hundreds in parts and also how it will automatically set the right cframe positions since these all put the parts on top of each other. |
|
|
| Report Abuse |
|
|
|
| 12 Jan 2015 12:10 PM |
Yes there is a way.
However, I do not know this way.
TO shed some light,
local Welds = {}
local weld = function(p1, p2, c0, c1) local w = Instance.new("Weld") w.P0 = p1 w.P1 = p2 w.C0 = c0 or CFrame.new() w.C1 = c1 or CFrame.new() return w end
weld(Workspace.Part, Workspace.Part1, CFrame.new(5,5,5)) etc.
There is a way to automatically weld all parts... Something about this can be learned in CFrame... I believe the methid was :ToObjectSpace() and stuff. |
|
|
| Report Abuse |
|
|
| |
|
|
| 12 Jan 2015 03:13 PM |
local model = workspace.Model local mainPart = model.PART
for i, v in pairs(model) do if v:IsA("BasePart") and v ~= mainPart then local weld = Instance.new("Weld", v) weld.Part0 = mainPart weld.Part1 = v weld.C0 = mainPart.CFrame:inverse() * v.CFrame end end
logic is logical |
|
|
| Report Abuse |
|
|
|
| 12 Jan 2015 03:18 PM |
| That works how I want it, can someone explain how you got that this? |
|
|
| Report Abuse |
|
|