"Tweening" the camera?

I’m trying to obtain this effect on the camera:
https://gyazo.com/8929354b2e0801762077742c7d106ef9 (The game is SCP: Roleplay)
You can see how the camera isn’t the usual linear and smooth thing we all know. It’s kind of “slower”, like it’s being tweened, or lerped. I already know how to lerp the character smoothly, however I’m not looking for that, but to replicate the effect on the camera. I tried lerping the CFrame like this:
CurrentCamera.CFrame = CurrentCamera.CFrame:Lerp(CFrame.new(CurrentCamera.Position))
But that didn’t work and, instead, when you try to move the camera, it gets stuck in the same position which makes sense.
Anybody knows how to obtain this effect? Or maybe another post which I haven’t found? Honestly I didn’t know what to search, I looked for “Lerping the Camera” or “Tweening the Camera” but couldn’t find anything I need.

3 Likes

I asked this question to the creator of that game once, apparently he uses Lerp().

Yeah that’s what I thought too, but I’m unsure on how to do it.

I would tell you how, but I am also unsure. Sorry.

1 Like

I’m pretty sure this effect can be achieved through changing the Humanoid.CameraOffset, and changing the workspace.CurrentCamera.FieldOfView.
You would need to use tweenservice to get the smooth movement, but you don’t need to set the CFrame of the camera.

It’s not that, I need that “smooth and slow” camera effect, which apparently is obtained with lerping. I know how to do an over-the-shoulder camera already.

Are we working with something or no?
What i mean is have you tried anything or have not and just want us to provide ideas or ways to implement even give you example code…

Yes, I tried with this:
CurrentCamera.CFrame = CurrentCamera.CFrame:Lerp((CFrame.new(CurrentCamera.Position)),0.2)
I thought that by changing the position only, the orientation wouldn’t be affected, however it just gets stuck. Even just an idea about how I can implement it would be good, I’d try to script it by myself.

it seems to me that if I leave the camera it moves like a “bubble” effect Screenrecorder-2021-03-08-11-14-40-934.wmv (8,1 MB)
(I don’t know if you have to change to mp4)

1 Like

Yep that’s what I’m trying to obtain.

1 Like

You have to use a loop (For, repeat, etc.) to obtain what you showed in the example.
Example:

for I = 0, 1, .1 do
     Camera.CFrame = Camera.CFrame:Lerp(Vector3Pos, I)
     wait(0.01)
end
1 Like

What would happen when the for loop reaches 1 though? It would just stop right?

It would reach the target position. (If you used CFrame the camera will also rotate to the target cframe)

This kind of what I tried, but I lerp it in a RenderStepped event. This is the issue I have, which is the same that I described in the thread:
https://gyazo.com/43f9136bb5c63b5054ef66f9f7339b00
The camera just gets stuck. The code is still:

CurrentCamera.CFrame = CurrentCamera.CFrame:Lerp(CFrame.new(CurrentCamera.CFrame.Position), 0.2)

Yes, because you’re trying to lerp the camera’s CFrame to itself.

Yep, but I don’t know how to make it lerp but by keeping its normal behavior (zoom in/out, stay behind the player, etc…).

You can’t set a camera’s CFrame without setting its behavior to scriptable.

Yeah I guess I’d have to re-write the whole camera script, which I think I’ll do if I really need it. Thanks for the answers anyways.

Use TweenService!

local TweenService = game:GetService("TweenService")
local Camera = workspace.CurrentCamera
local Tween = TweenService:Create(Camera, TweenInfo.new(3), {CFrame = CFrame.new(your cframe.)})
Tween:Play()
  1. Make sure the camera type is set to scriptable.
  2. Tween it into the lerp position using Tween Service.
  3. Lerping it into the same position won’t do anything. Make sure it’s different.

ERROR:

CurrentCamera.CFrame = CurrentCamera.CFrame:Lerp(CFrame.new(CurrentCamera.Position))

CORRECT (IMAO):

local cf = camera.CFrame:Lerp(character.RightUpperArm.CFrame,0.75)
local tween = tweenService:Create(camera,TweenInfo.new(),{CFrame=cf)
tween:Play()

I assume you know what variables go to what (eg. TweenService, camera, character)
Reply me if anything goes wrong.