Smooth C1 CFrame Movement Problem

Hello, I’m trying to CFrame a welded part that is the C1 of the Motor6D.
The Script

	local start = script.HangarEntrance.Value.HangarDoor1.CFrame
	local finish = script.HangarEntrance.Value.HangarDoor1.CFrame * CFrame.new(1, 0, 0)

	for progress = 0, 1, 0.03 do
		script.HangarEntrance.Value.HangarDoor1.Motor6D.C1 = script.HangarEntrance.Value.HangarDoor1.Motor6D.C1:lerp(finish, progress)
		wait()
	end

What it does

What I want it do is smoothly lerp backwards 1 stud.

I can provide more information if needed, thanks.

Probably something just like

	local start = script.HangarEntrance.Value.HangarDoor1.Motor6D.C1
	local finish = start * CFrame.new(1, 0, 0)

	for progress = 0, 1, 0.03 do
		script.HangarEntrance.Value.HangarDoor1.Motor6D.C1 = start:lerp(finish, progress)
		wait()
	end
1 Like

C1 is relative to the part1 of the Motor6D,if you want to make it in worldspace you will need to inverse the part1 CFrame I believe.

Try this out, it also uses tween service to do it which should be smoother than a for loop with wait().

local TweenService = game:GetService("TweenService")

local hangarDoor = script.HangarEntrance.Value.HangarDoor1
local start = hangarDoor.CFrame

local relativizeToWorld = hangarDoor.Motor6D.Part1:Inverse()
local finish = relativizeToWorld*hangarDoor.CFrame*CFrame.new(1, 0, 0)

local doorTweenInfo = TweenInfo.new(1)
local goal = {C1 = finish}
local openTween = TweenService:Create(hangarDoor.Motor6D,doorTweenInfo,goal)
openTween:Play()
1 Like

Thanks for the reply!
Yes, that would work, but I can’t use Tweening as the parts have to be unanchored.

Worked perfectly, thank you! : D