Answered by
6 years ago Edited 6 years ago
There is nothing particularly wrong with the code, it's just inconvenient.
Camera:Interopolate tweens the Camera in a linear fashion towards a new Camera.CFrame and Camera.Focus over a given duration.
If you fire it once, it'll go all the way from point A to point B.
But since you're doing this at a rate of 1/60th of a second, there are multiple tweens running at the same time and they all have a different goal to tween to since the point B is constantly changing.
We have another method for this, Lerping. (:lerp()
)
This stands for Linar Interopolation, and is similar to Camera:Interopolate, but it doesn't go from point A to point B when you fire it once.
It returns the position of the caculated distance between point A and point B by the desired step. (In your case, 0.5.)
1 | local Camera = workspace.CurrentCamera |
4 | game:GetService( "RunService" ).RenderStepped:connect( function () |
5 | Camera.CameraType = Enum.CameraType.Scriptable |
6 | Camera.CameraSubject = workspace.plane.Front |
8 | Camera.CoordinateFrame = Camera.CoordinateFrame:lerp(CFrame.new(workspace.plane.Front.CFrame* CFrame.new( 0 , 10 , 50 ).p ,workspace.plane.Front.CFrame.p), . 5 ) |
If you run :lerp() rapidly, it probably won't stutter anymore because unlike tweening, it won't go from point A to the previous point B, but instead it will go from point A to wherever the point B is at, when it's fired.
You might've not understood some of the stuff I said, I'm really not the best at explaining.
If you have any questions, you're free to ask and I'll try to answer it as easily as possible.
Thanks for reading, I hope I helped.