#How can i make head rotation influence the camera>?

5 messages · Page 1 of 1 (latest)

celest bramble
#
local Character : Model = Player.Character
local Humanoid : Humanoid = Character:WaitForChild("Humanoid")
local HumanoidRootPart : BasePart = Character:WaitForChild("HumanoidRootPart")

local Camera = workspace.CurrentCamera

-- Services --
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerScriptService = game:GetService("ServerScriptService")
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
local UserInputService = game:GetService("UserInputService")

local CamOffset = CFrame.new()

RunService.RenderStepped:Connect(function(DT)
    Camera.CFrame = Camera.CFrame:Lerp(Character.Head.CFrame,0.1)
end)

This code works partially, the head will rotate to follow the camera giving me accurate camera shake effects, however it doesn't allow for looking downwards, and the character will turn slightly to face the camera

celest bramble
loud anchor
# celest bramble ```lua local Character : Model = Player.Character local Humanoid : Humanoid = Ch...
local camera = workspace.CurrentCamera

local character = game.Players.LocalPlayer.Character
local root = character:WaitForChild("HumanoidRootPart")
local neck = character:FindFirstChild("Neck", true)
local yoffset = neck.C0.Y

local CFNew, CFAng, asin = CFrame.new, CFrame.Angles, math.asin()

game:GetService("RunService").RenderStepped:Connect(function()
    local cameraDirection = root.CFrame:toObjectSpace(camera.CFrame).lookVector
    
    if neck then
        neck.C0 = CFNew(0, yoffset, 0) * CFAng(0, -math.asin(cameraDirection.x), 0) * CFAng(asin(cameraDirection.y), 0, 0)
    end
end)
loud anchor