Hello, I’ve recently been trying to make a good system which makes the character look at where the camera is looking.
While I know how to make the characters head follow the camera, there’s one thing I’m having trouble with.
I’m trying to make this system for first person, when I look around in first person the system would make the head look up and down, but the rest of the body would follow the head looking left and right
In short, I want the rest of the body to stay in the same orientation until the player looks too much to the left or right.
local cam = workspace.CurrentCamera
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local hrp = char:WaitForChild("HumanoidRootPart")
local neck = char:FindFirstChild("Neck", true)
local y = neck.C0.Y
game:GetService("RunService").RenderStepped:Connect(function()
if neck then
local camDirection = hrp.CFrame:ToObjectSpace(cam.CFrame).LookVector
neck.C0 = CFrame.new(0, y, 0) * CFrame.Angles(0, -camDirection.X, 0) * CFrame.Angles(camDirection.Y, 0, 0)
end
end)