Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Head rotation based on camera not working?

Asked by
Jo_Bot 67
6 years ago

I created a similar question recently, about a script I created not working with a custom character, andI worked on my script and got it almost working, but the offset of the head rotation is off, and I can't seem to fix it. script:

local player = game.Players.LocalPlayer
local character = player.character
local head = character.Head
local uppertorso = character.UpperTorso
local lowertorso = character.LowerTorso
local camera = game.Workspace.CurrentCamera
local uis = game:GetService("UserInputService")
local rs = game:GetService("RunService")

function headMove()
    local camangle = camera.CFrame.lookVector
    character.UpperTorso.Neck.Transform = CFrame.Angles(camangle.y,camangle.x, 0)
    print(character.UpperTorso.Neck.Transform)
end

rs.Stepped:Connect(headMove)

And here is how it is behaving (GIF is low quality, sorry)

https://media.giphy.com/media/1Be1NCGYjZIzmuRzw6/giphy.gif

0
The link should work, but basically it shows that the offset of the Neck Motor6D's Transform is off, and not centered. Jo_Bot 67 — 6y
0
I don't know if this is helpful, but it is also using the Default Animations. Jo_Bot 67 — 6y
0
oof I fixed it useing camera.CFrame.rightVector :P Jo_Bot 67 — 6y

Answer this question