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

How to lerp rotation?

I know you can use Cframe:lerp() for moving a part to another point but is there a way you can lerp the rotation of a brick?

1 comment

0

What are you exactly trying to do? Because if you're just rotating on one axis continually, why not just do while wait() do brick.CFrame = brick.CFrame * CFrame.Angles(0,math.rad(1),0) end

3 answers

✓ Accepted answer

here is an example of rotating with angels. all you have to do is use CFrame:lerp(CFrame.new()*CFrame.Angels()) so try ..

local p = Instance.new("Part", workspace)
p.Anchored = true
wait(3)
for i = 0, 1,0.0001 do -- for smooth cframing
p.CFrame = p.CFrame:lerp(p.CFrame * CFrame.Angles(0,0,math.rad(45)) , i)
--you can only use the CFram:lerp() method when it is the cframe of an object
wait(0.01)
end

2 comments

0

Thanks, btw the lerp method has a 3rd parameter for time so I wont need to use the for loop.

0

that must be new, huh

may i see the code?

5 comments

0

There isnt any code, all I want to do is just smoothly animate a rotation, using lerp if possible.

0

aha

0

well what i would do is make it into like a humanoid with all the body parts and script a script for custom animation and make one with the roblox animation editor

0

Just for one rotation? I meant like one part rotating smoothly, for example a door.

0

no not an entire just make like one left arm because with no arms and leg and the object would be needed to be named head and then animated

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