I am trying to make a smooth, first person POV spectating system, so I tried using the Interpolate function of a player's camera. Here's how I do it (inside a LocalScript in StarterPack):

-- NOTE: "randomPlayer" is a variable referring to another player in the game that isn't the local player.

local cam = game.Workspace.CurrentCamera

while wait() do
	if randomPlayer.Character and randomPlayer.Character:FindFirstChild("Head") then
		cam:Interpolate(randomPlayer.Character.Head.CFrame, 	CFrame.new(randomPlayer.Character.Head.CFrame.lookVector), 1/60)
	end
end

It works smoothly, and it follows the character's head, but the problem is that the camera is always facing towards position (0, 0, 0) no matter what I set the second input parameter (the endFocus) to. Even if the player's head is facing the complete opposite direction, the camera focuses on (0, 0, 0). If the player's head is in an elevated area, it tilts the camera sideways to be focusing on (0, 0, 0).

3 comments

0

This is because you are setting the Position to the lookVector. Try setting EndPos to: CFrame.new(randomPlayer.Character.Head.Position,randomPlayer.Character.Head.lookVector).

0

I did what you said, but the problem is still occurring. Oh, and by the way, it should be 'Head.CFrame.lookVector', not 'Head.lookVector'.

0

Yeah, I was rushed. Note that recently I have been having problems with Interpolate (it must be stuffed up or something, idk, but it never works anymore for me), random things happen instead of the camera tweening position the way it's supposed to.