How to Clone Rig / Joints and Keep the AbsolutePosition (Custom Character)?

I made a sketch of my problem:

Picture 1 is a model of my custom character. It’s rigged with joints (pink), but has some parts that I want removed (green). So I had the green removed in blender and was left with the model in Picture 2. Since it’s unrigged now, I want to transfer the joints from the model in Picture 1 to the model in Picture 2. As shown in sketch, the joints should have the same position, and that’s what I’m having trouble with.

What I’ve tried to do is placing both models in the same position:
Model1:SetPrimaryPartCFrame(Model2.PrimaryPart.CFrame)

Then I run this script where I basically copy the joint properties from the rigged model (Picture 1) and put it in the edited model (Picture 2):

local MODEL1 = workspace.Model1
local MODEL2 = workspace.Model2

for _, v in pairs(MODEL1:GetDescendants()) do
	if v.ClassName == "Motor6D" then
		local motor = Instance.new("Motor6D", MODEL2[v.Parent.Name])
		motor.Name = v.Name
		motor.C0 = v.C0 
		motor.C1 = v.C1
		motor.Part0 = MODEL2[v.Part0.Name]
		motor.Part1 = MODEL2[v.Part1.Name]
	end
end

But what I ended up with is the model in Picture 3. Two of the edited parts has moved upwards whereas the circle part, which has also been edited, is unaffected. My theory is that the other parts have moved because their overall sizes have changed, whereas the circle’s boundary size hasn’t changed. Which means I have to somehow offset the size difference when copying the joints.

Any idea how I can solve this problem? I basically want to copy the joints and keep them in the same AbsolutePosition. But since C0 and C1 are relative they get messed up when the edited model’s part is smaller (I think that’s the problem).

1 Like

Took me the whole day but I managed to solve this by manually offsetting the C0 and C1 of each joint by how much the position has changed for Part0 and Part1.

3 Likes