How do I make the player circle around an object despite having camera offset?

  1. What do you want to achieve?
    I’m trying to make a camera lock on system like Soulshatters, in Soulshatters, you can circle the character around a dummy with camera offset. I was trying to achieve this but end up getting a very weird spiral shape movement as can be seen here

https://gyazo.com/f9cd73290b844b8b244224ef0e79d333
You can see that when I press A, it goes farther from the center point, while when I hold D, it does the opposite.
image
That is what happens when you circle around the center point with A

  1. What is the issue?
    I believe the issue was the camera’s X offset, as when I completely remove the X offset, it works normally (With offset in the X axis, you’re like further away from the actual character, making moving horizontally like that)

  2. What solutions have you tried so far?
    I did try to look for solutions in developer hub, but so far I can’t find any or any camera api that can do this, I’ve been looking for a solution in the past 2 hours now and I can pretty much say I’m desperate, please help me if you know the solution.

-- lockOnTarget is basically the dummy's HumanoidRootPart
-- HumanoidRootPart CFrame math:
local cfam = CFrame.lookAt(hrp.Position, Vector3.new(lockOnTarget.Position.X, hrp.Position.Y, lockOnTarget.Position.Z))
hrp.CFrame = cfam
-- Camera CFrame math:
Cam.CFrame = CFrame.lookAt((cfam * CFrame.new(Vector3.new(12 --[[change this to 0 and the problem is fixed]], 2, 8))).Position, lockOnTarget.Position)

holy necropost but i have a similar formula to yours with the same problem, did you ever fix it?