Function to Fix/Scale Animations with Position Problems and Another to Convert to Top Bottom Animations

If you have a bunch of animations that are all wonky when you scale them then try running thisin your command prompt to fix your animations! I remember animating and not know this was a horrible pain when I realised positions mess up animations when you resize the model. :stuck_out_tongue:

local ansc=0
local ar=workspace.AnimSaves:GetDescendants() 
for i,v in pairs(ar) do if v:IsA("Pose") then
 local v1,v2,v3,C0,C1,C2,c3,c4,c5,c6,c7,c8 = v.CFrame:components() 
v.CFrame=CFrame.new(v1*ansc,v2*ansc,v3*ansc,C0,C1,C2,c3,c4,c5,c6,c7,c8) end
 end 

Also if you wish to only fix the arms and legs use this function

local ar=workspace.AnimSaves:GetDescendants()
 nametbl={"LeftUpperLeg","RightUpperLeg","LeftUpperArm","RightUpperArm","LeftHand","LeftFoot","RightLowerArm","RightHand","RightFoot","RightLowerLeg","LeftLowerLeg"} 
for i,v in pairs(ar) do if v:IsA("Pose") and table.find(nametbl,v.Name)~=nil then x,y,z,C0,C1,C2,c3,c4,c5,c6,c7,c8 = v.CFrame:components() v.CFrame=CFrame.new(0,0,0,C0,C1,C2,c3,c4,c5,c6,c7,c8) end end 

The code gets the components of the CFrame and sets the postion to 0,0,0 you can try scaling v1,v2,v3. If that is neccessary for your application. Good luck! Be careful because this writes over the location so if you wish to test it try making a copy!

image
It works very good for converting old broken R15 animations to work with modern R15 Rigs.

7 Likes

Also we can use a variant of this function to seperate the top and bottom of the anim save for easy conversion of animations to two parts.

function Sepanims()
	local ar2=workspace.AnimSaves:Clone():GetDescendants()
	
	local ar=workspace.AnimSaves:GetDescendants()
	ar.Name="TopAnimSaves"
	ar2.Name="BottomAnimSaves"
	local bottom={"HumanoidRootPart","LeftUpperLeg","RightUpperLeg","LeftFoot","RightFoot","RightLowerLeg","LeftLowerLeg","LowerTorso"} 
	local top={"HumanoidRootPart","UpperTorso","LeftUpperArm","RightUpperArm","LeftHand","RightLowerArm","RightHand","Head"}
	for i,v in pairs(ar) do
		if v:IsA("Pose") and table.find(top,v.Name)~=nil then 
			v:Destroy()
		end
	end
	for i,v in pairs(ar2) do
		if v:IsA("Pose") and table.find(bottom,v.Name)~=nill then 
			v:Destroy()
		end
	end
	ar2.Parent=ar.Parent
end
5 Likes

I update this posted with a animation scale variable! (ansc).
To keep same function as original post I set it to 0, but you can change it to suit your needs.