Welding parts by attachment cframes

So I’m going to make simple custom tool system and for equipping function I need to use WeldConstraint to weld handle of the tool with the right arm. Handle must be positioned in the way so attachment of handle aligns with right arm’s grip attachment.
And so it’s late evening for me and my brain refuses to get the math in script right to get it working properly. Fixing one thing and bumping into another issue.
I need help, also I’m going to answer for next hour and after that probably going to go to sleep.

For weld constraints you solve for the part1.

Same equation for welds applies with attachments as well.

Weld formula
part1.CFrame * C1 == Part0.CFrame * C0

Attachment formula
part1.CFrame * Attach1.CFrame == Part0.CFrame * Attach0.CFrame

--solve for part1 CFrame
--multiply right hand side of both equations by attach1.CFrame:Inverse()
part1.CFrame = Part0.CFrame * Attach0.CFrame * attach1.CFrame:Inverse()

Formula for normal welds

1 Like

Ok ty, I’ll try tomorrow cuz going to sleep soon

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.