Camera that stays behind character using "Custom" CameraType

  1. What do you want to achieve?
    I want to achieve a camera which always returns behind the player’s character while utilizing Custom CameraType (So core Roblox camera systems.)
  2. What is the issue?
    I am not very good with CFrames and I can’t figure out a good solution because I tried by tweening the camera CFrame on RenderStepped like this (this is a script in StarterCharacterScripts):
local camera = game.Workspace.CurrentCamera
local hrp = script.Parent.HumanoidRootPart
game:GetService("RunService").RenderStepped:Connect(function()
	game:GetService("TweenService"):Create(camera,TweenInfo.new(0.3,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{CFrame = CFrame.new(camera.Focus.Position):ToWorldSpace(CFrame.new(0,0,(hrp.CFrame.Position-camera.CFrame.Position).Magnitude))*CFrame.fromOrientation(0,math.rad(hrp.Orientation.Y),0)}):Play()
end)

Sadly It’s not correct because it keeps tearing as it would move towards the HumanoidRootPart and it only sort of does what I was thinking of doing. Again,
I’m bad with CFrames :frowning: It gives this result, which is visibly very teary:

  1. What solutions have you tried so far? I looked around DevHub for a long while and tried different methods, but to no avail.

If someone could provide how I’m actually supposed to calculate this, I will be very grateful! :slight_smile:

1 Like