Issues on converting pose CFrame to C1

How does pose.CFrame get calculated? And what does it calculate to, a CFrame that has the center as rootpart? Or is it with the actual part1 itself?

Context: I am trying to make a manual animation player. And I am using C1 for the animation but I cant find a way to convert pose CFrame to that. So how does one do that?
Not on local side either incase you are asking.

Let me repeat this back one more time incase if its hard to understand.
Lets say I have a part of a rig that has a motor6d with “0.3,1,0” as CFrame positions and C1 as “2,0.6,0” and I have a pose that has “2,-3,1” CFrame positions. How do I convert the pose’s CFrame position to be addable (cf*cf) to the C1’s position to move it to where it is in roblox/moon animator? Because pose’s CFrame is calculated off of C0 and C1 so I am searching the formula to convert it back to be useable as position but then convert it to C1. How can I achieve this?

2 Likes

Try this out

It has not worked, I’ll send the script so you can examine it. (It’s a bit messy because I’ve been going insane trying to fix it)

local module = {}
local char
local looping=false
local currentplaying
local currentplayingname=nil
local active={}
local poseToEasingMap = {
	[Enum.PoseEasingStyle.Linear] = Enum.EasingStyle.Linear,
	[Enum.PoseEasingStyle.Constant] = Enum.EasingStyle.Sine,
	[Enum.PoseEasingStyle.Elastic] = Enum.EasingStyle.Back,
	[Enum.PoseEasingStyle.Cubic] = Enum.EasingStyle.Quad,
	[Enum.PoseEasingStyle.Bounce] = Enum.EasingStyle.Bounce,
}
local poseToEasingDirectionMap = {
	[Enum.PoseEasingDirection.In] = Enum.EasingDirection.In,
	[Enum.PoseEasingDirection.Out] = Enum.EasingDirection.Out,
	[Enum.PoseEasingDirection.InOut] = Enum.EasingDirection.InOut,
}
local connection={}
local originals={}

function module.ConnectRig(rig:Part) char=rig
	connection={}
	for i,v in pairs(rig:GetDescendants()) do
		if v:IsA("Motor6D") then
			connection[v.Name]=v
			originals[v.Name]=v.C1
			--print(originals)
			--print(originals[v.Name])
		end
	end
end
function module.CurrentPlaying() return currentplayingname end
function module.PlayAnimation(loopings,animt,weight)
	if weight==nil then weight=0 end
	--if currentplaying~=nil then module.StopAnimation() end
	currentplayingname=animt
	pcall(function() module.StopAnimation(true) end)
	local isitover=false
	currentplaying=task.spawn(function()
		looping=loopings
		local anim=script:FindFirstChild(animt)
		local firsttimeline=anim:GetChildren()
		table.sort(firsttimeline,function(a,b) return a.Time<b.Time end)
		--for i,v in ipairs(firsttimeline) do
		--	print(v.Time)
		--end
		local truetimeline={}
		for i,v in ipairs(firsttimeline) do
			for n,g in pairs(v:GetDescendants()) do
				if g:IsA("Pose") and g.Name~="HumanoidRootPart" then
					local gcf=(g==CFrame.new(0,0,0) and truetimeline[g.Name]~=nil and truetimeline[g.Name][#truetimeline[g.Name]][2]) or g.CFrame
					print(g.Parent)
					print(g.CFrame)
					print(g.Name)
					if truetimeline[g.Name]==nil then truetimeline[g.Name]={} end
					table.insert(truetimeline[g.Name],{v.Time,gcf,g.EasingStyle,g.EasingDirection})
				end
			end
		end
		--print(truetimeline)
		repeat
			for i,v in pairs(truetimeline) do
				task.spawn(function()
					for n=1,#v do
						local found=v[n]
						--for i,v in pairs(found) do
						--	print(v)
						--end
						--print(found[3])
						local othertime=((n>1 and v[n-1]) or {-weight})
						--local addthat=(n~=1 and n~=#v and connection[i].C1) or originals[i]
						--print(char:FindFirstChild(i).CFrame)
						--local N=char:FindFirstChild(i).CFrame
						--print(N)
						local twe=game:GetService("TweenService"):Create(connection[i],TweenInfo.new(found[1]-othertime[1],poseToEasingMap[found[3]],poseToEasingDirectionMap[found[4]]),{C1=connection[i].Part1.CFrame:Inverse()*connection[i].Part0.CFrame * connection[i].C0 * found[2]})
						twe:Play()
						table.insert(active,twe)
						task.wait(found[1]-othertime[1])
						table.remove(active,table.find(active,twe))
					end
					connection[i].C1=originals[i]
				end)
			end
			--print(firsttimeline[#firsttimeline].Time)
			task.wait(firsttimeline[#firsttimeline].Time)
		until not looping
		for i,v in pairs(connection) do
			--print(v.C1)
			--print(i,originals[i])
			v.C1=originals[i]
		end
		currentplayingname=nil
		isitover=true
	end)
	return function()
		return isitover
	end
end
function module.StopLoop() looping=false end
function module.StopAnimation(using) 
	task.cancel(currentplaying)
	task.wait(0.3)
	for _, tween in ipairs(active) do
		tween:Cancel()
		--print("tween detected")
	end
	currentplaying=nil
	active={}
	if using then return end
	for i,v in pairs(connection) do
		--print(i)
		v.C1=originals[i]
	end
end --still working on this part after I fix the play animation part

return module

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.