# Help with CFraming the camera to look at the player

Hello, I am making a cinematic for when a player presses play in which it will zoom and place the camera right behind the player looking at the back of their head. How can I achieve this? I positioned the camera behind the player with this code; `local pos_goal = character.PrimaryPart.CFrame * CFrame.new(0, 1, 5)` but let’s say if your player is rotated and looking somewhere else this will position behind them but won’t be looking at them.
Heres a video;

if anyone could help me out I would greatly appreciate it I struggle with Coordinate Frame mathematics and I would like to get better.

2 Likes

make it ones the player has clicked the button, it updates the camera pos_goal and then tweens it to the given position

Well, the problem Is I want it to ‘tween’ behind the player facing the back of the player’s head no matter where or how the player is positioned or orientated and I cant do that without CFrame mathematics.

The position goal should be something like this

``````local pos_goal = CFrame.new((character.PrimaryPart.CFrame * CFrame.new(0, 1, 5)).Position,character.PrimaryPart.Position)
``````

what you could do is get the back vector of the players head and then moving the camera from a players head to thr back vector direction. You can get the back vector of the head by multiplying the lookvector with -1

``````local players = game:GetService("Players")
local player = players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local hrp = character:WaitForChild("HumanoidRootPart")
local camera = workspace.CurrentCamera