Calculating CFrame to imitate welds

I’m making a backpack GUI that renders the tools in the tool slots.
I need to weld in ViewportFrames. The problem is, physics doesn’t work in ViewportFrames, meaning welds don’t work. So, I need to calculate the CFrame as if I were using welds.

My current solution puts the tool in the workspace, welds, anchors, and then puts it back in the ViewportFrame. This is obviously a terrible solution.

See Weld | Roblox Creator Documentation

While the weld is Active, it maintains the part positions such that:
part1.CFrame * C1 == Part0.CFrame * C0

So if you wanted to position part1 based on the other weld properties you could do

part1.CFrame = C1:Inverse() * Part0.CFrame * C0
2 Likes