Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do i animate with CFrame in a way that seems less confusing?

Basically i make script builder stuff and now i am making a SB weapon and i want to know a less confusing way to animate frame by frame with CFrame. I know i dont have a script example i just wanna know how to do this.

1 comment

0

Search tweening in the roblox wiki.

2 answers

✓ Accepted answer

if this isnt confusing

local part = workspace.Part

for i = 0,1, 0.1 do
  part.CFrame = part.CFrame:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)), i)
end

4 comments

0

i cant explain it too much just run it and change it until you can an idea of it

0

I can animate a players arm with this too right?

0

yes

0

you would have to do stuff with the joints. so instead of part.CFrame its Torso["Left Shoulder"].C0

You can make animations using the animation editor and convert them to CFrame format using this animation converter

If you're looking for a lerp function to make things easier/quicker:

function Lerp(c1,c2,al)
	local com1 = {c1.X,c1.Y,c1.Z,c1:toEulerAnglesXYZ()}
	local com2 = {c2.X,c2.Y,c2.Z,c2:toEulerAnglesXYZ()}
	for i,v in pairs(com1) do 
		com1[i] = v+(com2[i]-v)*al
	end
	return CFrame.new(com1[1],com1[2],com1[3]) * CFrame.Angles(select(4,unpack(com1)))
end

1 comment

0

Oh my gosh i've been looking all over for an animation converter that works, thank you!

This discussion is preserved as it was. New answers, comments, and votes are closed.