I'm trying to get the head follow the mouse, i.e point towards the mouse - which I do by using the Head's orientation property and modifying it by the angle between the mouse's and the head's lookvectors. I thought it would be relatively simple, but apparently not.
This produces odd behaviour (video below) and I'm not sure how to fix it:
Here is the code.
local RunService = game:GetService("RunService")
local Player = game:GetService("Players").LocalPlayer
local Head = Player.Character:WaitForChild("Head")
local Mouse = Player:GetMouse()
RunService.RenderStepped:Connect(function()
local HeadLookVector = Head.CFrame.LookVector
local MouseLookVector = Mouse.Hit.LookVector
Head.Orientation = Vector3.new(math.deg(math.acos((HeadLookVector:Dot(MouseLookVector)/(HeadLookVector.Magnitude * MouseLookVector.Magnitude))), 0, 0))
end)

2 comments
Try just the mouses look vector. Tell me what it does though cause I’m curious lol
https://vimeo.com/421924564