I want to make the camera continuously face a characters HumanoidRootPart while also rotating around an origin point and moving closer / farther to maintain a certain distance from the part its looking at.
I currently have the code to make the camera face the part but i dont know how to make it move closer or farther from the origin while doing so.
Code:
local camOrigin = cam.CFrame.Position
local CamFollow = RunServ.RenderStepped:Connect(function()
if killedby.Character and killedby.Character:FindFirstChild("HumanoidRootPart") then
local hrp = killedby.Character.HumanoidRootPart
cam.CFrame = CFrame.new(camOrigin, hrp.Position)
end
end)
Bad Visual Representation of what im trying to achieve:
basically the camera should always maintain the same distance from the player while also rotating around the origin