Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How is Weld C0 really important for welding besides the fact it dermines where Part1 is at...?

Asked by 9 years ago

Like for example in this script...

local playa=game.Players.LocalPlayer;
Char = playa.Character

script.Parent.Selected:connect(function(mouse)
    while Wait() do
    weld = Instance.new("Weld",Char); 
weld.Name = "RMot";
weld.Part0 = Char.Torso;
weld.Part1 = Char["Left Arm"];
weld.C1 = weld.C0;

    --[[
        p0=part0.CFrame
        c0=c0
        p1=part1.CFrame
        c1=c1

        p1*c1 == p0*c0
        c1 == p1:inverse()*p0*c0
        c0 == p0:inverse()*p1*c1
    --]]
    local desired_p1=CFrame.new(--the CFrame that we want the arm to be at
                (weld.Part0.CFrame*CFrame.new(-1,0.3,-0.5)).p,--the position we want
                mouse.hit.p--look at the mouse
            )*
            CFrame.Angles(math.pi/2,0,0);--rotate it so that the hand points that way
    weld.C0=CFrame.new();--set C0 to identity matrix so it is out of the equation
    weld.C1=desired_p1:inverse()*weld.Part0.CFrame;--same equation as shown above
end end
)

at this line ->weld.C0=CFrame.new();--set C0 to identity matrix so it is out of the equation Why would you need to set identity matrix "out of equation" and also on the line after that why would part0's cframe need to be involved and why inverse?

Answer this question