How to calculate C1 of a weld/motor6d

I have a welding system for the character and I’ve used the C0 property of the weld to set the Cframe of the part. C1 was never used. Now I’d like to convert this C0 to C1 as im trying to convert my welds into animations. Is there a way I can set the C1 property of the weld using the cframe generated with the C0 property of the weld, I’d also like to have the same CFrame output when setting the C1 property.

So, you want to use only the C1 property for the weld, while C0 is an identity CFrame? (Blank CFrame - CFrame. new())

Yes, pretty much convert what i already have to C1

1 Like

Welds maintain the Part0 and Part1’s positions so that:

Part0.CFrame * C0 = Part1.CFrame * C1

If we are not going to use C0, we’ll make that the Identity CFrame which is just CFrame.new() with absolutely no arguments passed. If C0 is an identity CFrame, we can take that out of the equation, so we have:

Part0.CFrame = Part1.CFrame * C1

If we want C1 alone on the right hand side, we’ll have to multiply Part1’s CFrame by its inverse, since: A * A^-1 = I (identity), where A is a CFrame. Whatever you do on one side, it has to be done on the other to balance the equation, that means that the left side will have to be multiplied by Part1’s inverse. So, we’re left with:

Weld.C1 = Part0.CFrame * Part1.CFrame:inverse() 

I switched the sides because it looks better to me

4 Likes

Thanks it worked, I had to position my characters root part to (0, 0, 0) for it to work. Great explanation and easy to understand. Either way thanks alot!!