What do I want to achieve?
I’ve welded together a model with Motor6Ds in order to animate it with a dummy. I want to change the point that some of these parts rotate around, (like how an arm on a dummy rotates around the shoulder.)
Here is the simple script I’m using for welding:
local function weld(part0, part1, weldType, offset)
offset = offset or CFrame.new()
local weld = Instance.new(weldType or "Weld")
weld.Part0 = part0
weld.Part1 = part1
weld.C0 = part0.CFrame:Inverse() * offset * part1.CFrame
weld.Parent = part0
return weld
end
I’m not sure if I should be changing the C1 as well, or what. Any help is appreciated, thank you for your time.
Yes, you would need to change the C1, if the arm is Part1.
This function looks like “offset” means “offset the whole part”. You could change the meaning to be “offset of the weld” (keeping the part where it is) like this:
local function weld(part0, part1, weldType, weldOffset)
weldOffset = weldOffset or CFrame.new()
local weld = Instance.new(weldType or "Weld")
weld.Part0 = part0
weld.Part1 = part1
weld.C0 = part0.CFrame:Inverse() * part1.CFrame * weldOffset
weld.C1 = weldOffset
weld.Parent = part0
return weld
end
I appreciate the help, but using this has no different effect for me. The part still rotates around its center. The end goal of this is to make a bow that (funnily enough) bows as it’s drawn through animations and segmented limbs. As a result the part 0s and part 1s are the segments of the bow’s limbs.If you need additional information, let me know.
Oh. Sorry about that. I didn’t. I see now that the script works. I’m not very accustomed to math with CFrames, would you mind letting me know how to find my desired offset for each part? I understand if not, I’m marking you as the solution anyway. Thank you for your help