Camera fully follow head

Yo, i’m thinking how I could do that the current Camera is fully follow the head, position and rotate, i already done the y position

here the script

local plr = players.LocalPlayer
local cam = workspace.Camera
local char = plr.Character

runservice.RenderStepped:Connect(function(deltaTime)
local pos = cam.CFrame.Position
local camcf = CFrame.new(pos.X, char.Head.CFrame.Position.Y, pos.Z)
cam.CFrame = camcf * cam.CFrame.Rotation
end)

technically its working, but it’s janky and it is following every movement of the head, i don’t want that, only to up and down movement (sorry i forgot to specify)

You can set the Camera.CameraSubject to the head of the Character.

After, you can adjust the CameraType to “Attach”

For more CameraType Enum’s, look here: CameraType | Documentation - Roblox Creator Hub

I hope this is your solution.
Thank you

CameraSubject can work but it give other problems because we change it into a part instead of the humanoid and because i want to do other things based on the position

Could you further explain in detail the issue and the desired outcome you would like?

the red triangle is currently what i have
the blue triangle is what i want to achieve

1 Like

Ok, I think I might understand now.

You are wanting it the camera’s rotation to match the head’s rotation?

Like, if the player flipped then it would make the camera flip with it, aligned with the player’s head?

what do you want exactly? do you want it to follow the head’s orientation?

yes, that what i want to achieve just by changing the camera CFrame

local runService = game:GetService("RunService")
local camera = workspace.CurrentCamera
local player = game:GetService("Players").LocalPlayer
local character = player.Character

runService.RenderStepped:Connect(function()
	local head = character.Head
	local x,y,z = head.CFrame:ToOrientation()
	camera.CFrame *= CFrame.Angles(0,0,z)
end)

try this, not sure if this is what you want

I’ll try it tomorrow as fast i can, inkling put you as solution if it is

maybe smth like this

local player = game.Players.LocalPlayer
local camera = game.Workspace.Camera
local character = player.Character or player.CharacterAdded:Wait()

local head : Part = character:WaitForChild("Head")

local RunService = game:GetService("RunService")

RunService.RenderStepped:Connect(function(delta)
	local HeadCFrame = CFrame.lookAt(camera.CFrame.p, head.Position + head.CFrame.LookVector)
	camera.CFrame =  camera.CFrame:Lerp(HeadCFrame, .5)
	
	task.wait()
end)