Head and Body Rotations aren't correct

  1. What do you want to achieve? Keep it simple and clear!
    Correct head and torso rotations.
  2. What is the issue? Include screenshots / videos if possible!
    While the player’s body is rotated head and torso rotations aren’t correct.
    Problem video:
    20220424_195345
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I wasn’t able to find anything about that.
local plr = game.Players.LocalPlayer
repeat wait() until plr:GetAttribute("LoadCompleted")
local neckC0 = CFrame.new(0, 0.8, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1);
local waistC0 = CFrame.new(0, 0.2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1);
local camera = workspace.CurrentCamera;
local neck = plr.Character.Head.Neck;
local waist = plr.Character.UpperTorso.Waist;
local body = plr.Character.HumanoidRootPart
local function onUpdate()	
	local theta = math.asin(camera.CFrame.LookVector.y)
	local camera_angle = math.atan2(camera.CFrame.LookVector.X, camera.CFrame.LookVector.Z)
	local body_angle = math.atan2(body.CFrame.LookVector.X, body.CFrame.LookVector.Z)
	local theta2 = (camera_angle-body_angle)%(6.283185307179586)

	if theta2 > 1.5707963267948966 and theta2 < 4.71238898038469 then
		theta2 = 3.141592653589793 -theta2
	end
	neck.C0 = neckC0 * CFrame.Angles(theta*0.5, theta2, 0);
	waist.C0 = waistC0 * CFrame.Angles(theta*0.5, 0, 0);
end
game:GetService("RunService").RenderStepped:Connect(onUpdate);