CFrame Problem + Welds

So I have this problem involving CFrames and Welds.

So let’s say I weld these 2 parts together, arrow representing their direction/orientation. Part0 is the tall part and Part1 is the bottom part.

image

And if you know how welds work, they maintain their offset in CFrame.

image

Now what I want to know is the formula to set the C1 of the weld to make it so Part1 will always face a specific direction, regardless of Part0’s orientation.

image

Any help is appreciated!

Did you do any code for that? Maybe with it i can help you

Try making a Udim2.new for the one that you want to have the CFrame positioned. Also, you would have to make a certain property to scale the welds so it can stand up straight.

When C0 or C1 are changed, the CFrame of the root part of the assembly isn’t changed. You can make sure that part1 is the root part by anchoring it or making its RootPriority bigger than the RootPriority of part0.

Anchoring the part isn’t an option since I’m welding it to a player character.

I want the part that’s welded to face the same direction regardless of the orientation of Part0 by setting the C0/C1 values.

local RunService = game:GetService("RunService")

local targetLookVector = part1.CFrame.LookVector

weld.C1 = CFrame.new()

while part:IsDescendantOf(workspace) do
    local part1Pos = part1.Position
    local targetCf = CFrame.new(part1Pos, part1Pos+targetLookVector)
    weld.C0 = part0.CFrame:Inverse()*targetCf
    RunService.Stepped:Wait()
end
1 Like