How can I get the same head turning as in this game?
sorry for the crappy quality, the first recording was 93 mb and was 15 seconds long, obs or my pc was being rebarded for no reason, giving me unreasonably huge video sizes
How can I get the same head turning as in this game?
This has to do with Trigonometry, I found this video which should hopefully help your problem I’ve never worked with something like this before so hopefully this video helps
Any idea why this happens?
Do you have a walking animation for that ninja skin?
R6 rigs have a weird problem where the axis with the neck joint is swapped, or something along the lines of that. Can you show your current code?
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(math.asin(cameraDirection.y), 0, 0)
end
end)
Yea its a custom walking animation but i didn’t make it
Here’s some working code, at least for a default R6 rig.
Keep in mind, this is client side ONLY.
local camera = workspace.CurrentCamera
local players = game:GetService("Players")
local character = players.LocalPlayer.Character or players.LocalPlayer.CharacterAdded:Wait()
local torso = character:WaitForChild("HumanoidRootPart")
local neck = character:FindFirstChild("Neck",true)
local neckC0 = neck.C0
local yOffset = neck.C0.Y
local CFAng = CFrame.Angles
game:GetService("RunService") .RenderStepped:Connect(function()
local cameraDirection = torso.CFrame:ToObjectSpace(camera.CFrame).LookVector
local head = character.Head or nil
if neck and head then
neck.C0 = neckC0 * CFAng(-cameraDirection.Y/1.7,0,-(((head.CFrame.Position - camera.CFrame.Position).Unit):Cross(torso.CFrame.LookVector)).Y)
end
end)
You can tweak it how you like.
That is most likely the problem, unless it is really needed, I would remove the walking animation and see if it works
No, I believe he has the axis wrong, he should try the script I provided.
I have a custom walking animation and it works flawlessly with my code.
Oh yeah, it works, thanks!
awewaeeae