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

How would I use CFrame lerp?

Asked by 9 years ago

I really cant understand it, but it would be extremely helpful in my game.

1 answer

Log in to vote
15
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
9 years ago

Say you want to interpolate one brick between two orientations (position and rotation), you would use the new CFrame linear interpolation method.

local CFrame1=CFrame.new()
local CFrame2=CFrame.new(Vector3.new(10,10,10),Vector3.new())
for i=0,1,.01 do
    Part.CFrame=CFrame1:lerp(CFrame2,i)
    wait()
end

This will make the Part transition from the first CFrame to the second, in the same way that animations are interpolated. The same thing could be done for camera transitions as well.

0
How would this be used in a model? FortunaAdmin 19 — 5y
2
Sorry for late comment but you could do local CFrameM = workspace.(Model Name).PrimaryPart.CFrame:Lerp(CFrame1, i) Penomecco 9 — 5y
Ad

Answer this question