Camera Interpolation

Hello, I want to make a cut scene animation when i press a button to play and the camera moves between 2 objects. The issue that i am experiencing is that when i press the button, it does the animation but i want the final position of the camera to be facing the other way around because it faces toward the original brick that it was positioned on. I have tried to rotate the brick but that didn’t make a difference.

My code:

local Camera = game.Workspace.CurrentCamera 
local Player = game.Players.LocalPlayer

local pos2 = game.Workspace:WaitForChild("CustomCamPart")
local pos1 = game.Workspace:WaitForChild("CamPart")

local controls = require(game:GetService("Players").LocalPlayer.PlayerScripts.PlayerModule):GetControls()
controls:Disable()

script.Parent.MouseButton1Click:Connect(function()

	Camera.CameraType = Enum.CameraType.Scriptable
	local timeTaken = (Player.Character.Head.Position - pos2.Position).magnitude * 0.05
	Camera:Interpolate(pos2.CFrame, pos1.CFrame, timeTaken)
		wait(timeTaken)
end)


repeat wait() until Player.Character

Camera.CameraType = "Scriptable"
Camera.CFrame = game.Workspace.CamPart.CFrame
script.Parent.Enabled = true

script.Parent.Parent.Parent.Spawn.MouseButton1Click:connect (function ()
script.Parent.Enabled = false
Camera.CameraType = "Custom"
end)

I currently have a position behind the camera where the player is frozen, this is for a feature in the future and i want the camera to face the player.

I want it to face here:

but…

it ends up facing here:

i want the animation to play but to still be facing the way i am in the first image.

2 Likes

That is because here:

Camera:Interpolate(pos2.CFrame, pos1.CFrame, timeTaken)
	wait(timeTaken)
end)

your script is doing exactly what is it suppose to do; tween to pos2 and look at pos1 in the timeTaken amount of time. If you want the camera to face the player, then you would have to replace pos1 with the player’s character (I assume it’s the head). If I am understanding what you said correctly, your code should look like this:

	Camera:Interpolate(pos2.CFrame, Player.Character.Head.CFrame, timeTaken)
		wait(timeTaken)
end)

:Interpolate is depreciated, it suggests you use TweenService because it’s more superior.