How would I smooth a CFrame transition?

I’m currently creating a FPS(guns) Framework, and I’m having trouble Lerping CFrame’s. Can anybody help me out?

Here is what I have, as you see when I aim in, it isn’t smooth.

What’s your current code for zooming in? You seem to already know the solution, lerping.

I’m very sorry for the late response! Here is the code:
image

I forgot to say that,
GS.AimCFrame = CFrame.new(-0.9, 0.125, 0)
GS.DefaultCFrame = CFrame.new(0,0,0)

It looks like your just setting the position of the CFrame not actually lerping…

Yes, I’m trying to lerp it. Any Ideas on how to?

You would have two CFrames (or even just two invisible parts representing the different CFrames/positions), one for the position of the gun which isn’t in the hand (not aiming) and another CFrame in the position of the hand (aiming). And if you want to aim, you would have a for loop iterating over the different positions of the lerping sequence (sorry if I’m using the wrong terminiology).

Like this:

for i = 0, 1, 0.1 do
gunCFrame = gunCFrame:Lerp(aimingCFrame, i)
end

and then iterate the gun back to the non-aiming CFrame if that makes sense…

Here’s a video that might help you:

1 Like

Thank you, I appreciate this. Since I figured out how lerping works, I’ll just need to implement it.

2 Likes