Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
exarlus 72
6 years ago

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.

0
Search tweening in the roblox wiki. DaWarTekWizard 169 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago

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
0
i cant explain it too much just run it and change it until you can an idea of it Bucwheed 37 — 6y
0
I can animate a players arm with this too right? exarlus 72 — 6y
0
yes TheGreatSailor 20 — 6y
0
you would have to do stuff with the joints. so instead of part.CFrame its Torso["Left Shoulder"].C0 Bucwheed 37 — 6y
Ad
Log in to vote
0
Answered by
crome60 43
6 years ago
Edited 6 years ago

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
0
Oh my gosh i've been looking all over for an animation converter that works, thank you! EtherealTrin 45 — 6y

Answer this question