How to achieve camera effects like in The Strongest Battlegrounds? Especially with the camera focusing on head with smoothing

I’m so baffled as to how ROBLOX’s shiftlock works, I use the same camera script but get different results when I switch between shiftlock and normal camera, little imperfections and inconsistencies that no one has made topics of.

What I want:

What I actually have:

The code I use:

local cf: CFrame =  CFrame.lookAt(Player.Character.HumanoidRootPart.Position, Vector3.new(workspace.Camera.CFrame.LookVector.X * 90000, workspace.Camera.CFrame.LookVector.Y * 90000, workspace.Camera.CFrame.LookVector.Z * 90000))
offset = cf:PointToObjectSpace(Player.Character.Head.Position)

if Player.Character:HasTag("Welded") then
	HeadFocus = Vector3.new(offset.X, offset.Y - 1.5, -offset.Z)
else
	local cf: CFrame = Player.Character.HumanoidRootPart.CFrame
    offset = cf:PointToObjectSpace(Player.Character.Head.Position)
	HeadFocus = Vector3.new(offset.X, offset.Y - 1.5, -offset.Z)
end

It uses lerp and then applies it to Humanoid.CameraOffset:

local Scaler = math.clamp((dt * 0.5) * 25, 0, 1)

local LerpHeadFocus =  Player.Character.Humanoid.CameraOffset:Lerp(HeadFocus, Scaler)

The camera script is binded to Renderstep, priority 201.

If you don’t get it, I’ll tell you. The camera in my game when moved to a top down perspective will make certain errors, like when the position of the head is clearly inching towards a certain axis, the camera would instead inch towards anywhere but there.

In the strongest battlegrounds however, the camera seems to perfectly smooth to the player’s head position no matter the circumstance, which is the effect I want.

And no I do not want to use camera.CameraSubject as the lack of smoothing looks like it would give someone motion sickness, help is appreciated!!!

A lot of lerping plus some methematical functions like math.sin or math.cos probably

1 Like

I think it looks great! Try to make your own way of making stuff like the camera shakes. Like i said i think it looks amazing. And if you reallyyyy want to make it like tsb then you would actually just play around with the values.

1 Like

I believe TSB forks the PlayerModule to make camera movements follow the head.

1 Like

Yes this is what they do and it leads to no weird camera problems. Would recommend modifying the base camera script. There should be a function called GetSubjectPosition that you can modify, that’s what I do for my game.

1 Like

I’ve tried this before and this returns the same results as camera.CameraSubject, no lerping no smoothing and some motion sickness

Can you explain how you use it? I use CameraOffset but can’t seem to make GetSubjectPosition() to work

New information

local cf: CFrame =  CFrame.lookAt(Player.Character.HumanoidRootPart.Position, Vector3.new(workspace.Camera.CFrame.LookVector.X * 90000, workspace.Camera.CFrame.LookVector.Y * 90000, workspace.Camera.CFrame.LookVector.Z * 90000))
offset = cf:PointToObjectSpace(Player.Character.Head.Position)

Using this code for the offset gives the following result:

The camera moves backwards if I look down, and forwards if I look up. Although minor, it can be distracting sometimes

It seems to have something to do with the Y lookvector