Possible to convert C0 to C1?

So, I wanna convert this script made by @dthecoolest to C1 because I want to use this for my Moon Animation stuffs and it also helps me to make custom animations made from physics.


This happens when changing motor.C0 to motor.C1 in the script.

What I want is the Head to be in the Transparent Part by only modifying C1 of the neck (Motor6D).

Heyo, surprising this hasn’t been solved.

From the CFrame math article. CFrame Math Operations

--Solving for Weld.C0:
weld.Part0.CFrame * weld.C0 = weld.Part1.CFrame * weld.C1 
weld.Part0.CFrame:inverse() * weld.Part0.CFrame * weld.C0 = weld.Part0.CFrame:inverse() * weld.Part1.CFrame * weld.C1 
CFrame.new() * weld.C0 = weld.Part0.CFrame:inverse() * weld.Part1.CFrame * weld.C1 
weld.C0 = weld.Part0.CFrame:inverse() * weld.Part1.CFrame * weld.C1 
 
--Solving for Weld.C1:
weld.Part0.CFrame * weld.C0 = weld.Part1.CFrame * weld.C1 
weld.Part1.CFrame:inverse() * weld.Part0.CFrame * weld.C0 = weld.Part1.CFrame:inverse() * weld.Part1.CFrame * weld.C1 
weld.Part1.CFrame:inverse() * weld.Part0.CFrame * weld.C0 = CFrame.new() * weld.C1 
weld.Part1.CFrame:inverse() * weld.Part0.CFrame * weld.C0 = weld.C1

Now I’m going to challenge @imdednowgoaway to try to convert the solution for the weld C1 into a function just as I have for the weld C0.

Tip:
You should notice some similarities with my function and the weld C0 that was solved above.

I tried scripting using from your reply and the head ended up going to the backrooms…

here’s the script

local motor = script.Parent
local target = workspace.target

local function worldCFrameRotationToC0ObjectSpace(motor6DJoint,worldCFrame)
	local part1CF = motor6DJoint.Part1.CFrame
	local part0 = motor6DJoint.Part0
	local c1Store = motor6DJoint.C1
	local c0Store = motor6DJoint.C0
	local relativeToPart0 =  part1CF:inverse() * worldCFrame * c0Store

	local goalC0CFrame = relativeToPart0

	return goalC0CFrame
end

while true do
	task.wait()
	motor.C1 = worldCFrameRotationToC0ObjectSpace(motor, target.CFrame)
end

Nvm I’m just dumb :skull:

also thanks @dthecoolest for helping me solve my problem that was like 3 months ago lol

local motor = script.Parent
local target = workspace.target

local function worldCFrameRotationToC0ObjectSpace(motor6DJoint,worldCFrame)

	local relativeToPart0 =  worldCFrame:Inverse() * motor6DJoint.Part0.CFrame * motor6DJoint.C0

	local goalC0CFrame = relativeToPart0

	return goalC0CFrame
end

while true do
	task.wait()
	motor.C1 = worldCFrameRotationToC0ObjectSpace(motor, target.CFrame)
end
4 Likes

Nice catch there, I had the same issue because I thought it was similar for the C0 formula with substituting the middle term.

However instead for the C1 formula the part1 term is the one being inversed which is the target CFrame we gotta replace with our new goal CFrame, which is on the left hand side of the equation. Nice work.

weld.Part1.CFrame:inverse() * weld.Part0.CFrame * weld.C0 = weld.C1
--Subsitute part1 with some goalCFrame, to make part1 go to goal target
goalCFrame:Inverse() * motor6DJoint.Part0.CFrame * motor6DJoint.C0

local relativeToPart0 =  worldCFrame:Inverse() * motor6DJoint.Part0.CFrame * motor6DJoint.C0

No prob, I also spent months learning and getting the same backrooms issue during my months of learning and testing.

It’s because of the recursive effect the C1 → part1.CFrame → C1 → part1.CFrame

--the wrong formula with the wrong subsitution as seen from testing and above
	local relativeToPart0 =  part1CF:inverse() * worldCFrame * c0Store
motor.C1 = relativeToPart0 
2 Likes

example of how you can use the function for stuffs

2 Likes