What is C0 and C1 and how can i use them?

Im making a game and i believe i need to know what c0 and c1 is for it to run smoothly. Im aware these determne the location of the joint in the rig but im not exactly sure how to use c0 and c1 or how to manipulate them. And the Roblox DevHub isnt much help.

What im asking for is maybe an explanation on what they are and an example on how to use them. Help would be appriciated :grinning: thank you for your time

1 Like

The script below changes the angle of the mop in the character’s hand. The c0 is the part0 which is the character left hand and the c1 is the part1 which is the mop.

			local char = player.Character
			local mop = game.ReplicatedStorage.mop:Clone()
			local Weld = Instance.new("Motor6D")
			Weld.Name = "mopweld"
			mop.Parent = char.LeftHand
			Weld.Parent = mop
			Weld.Part0,Weld.Part1 = char.LeftHand, mop
			Weld.C1 = CFrame.new(Weld.C1.Position)* CFrame.Angles(0,math.rad(-90),0)

BEFORE


AFTER

You can also use it to move a character’s head like in the code below.

local Camera = workspace.CurrentCamera
local Player = game.Players.LocalPlayer
 
local Character = Player.Character
local Root = Character:WaitForChild("HumanoidRootPart")
local Neck = Character:FindFirstChild("Neck", true)
local YOffset = Neck.C0.Y
 
local CFNew, CFAng = CFrame.new, CFrame.Angles
local asin = math.asin
 
game:GetService("RunService").RenderStepped:Connect(function()
    local CameraDirection = Root.CFrame:toObjectSpace(Camera.CFrame).lookVector
    if Neck then
        if Character.Humanoid.RigType == Enum.HumanoidRigType.R15 then
            Neck.C0 = CFNew(0, YOffset, 0) * CFAng(0, -asin(CameraDirection.x), 0) * CFAng(asin(CameraDirection.y), 0, 0)
        elseif Character.Humanoid.RigType == Enum.HumanoidRigType.R6 then
            Neck.C0 = CFNew(0, YOffset, 0) * CFAng(3 * math.pi/2, 0, math.pi) * CFAng(0, 0, -asin(CameraDirection.x)) * CFAng(-asin(CameraDirection.y), 0, 0)
        end
    end
end)

EXAMPLE

2 Likes