Got this simple script which rotates the camera towards the direction you’re looking (up and down only)
local RATE = 1/10
local t = 0
runservice.Heartbeat:Connect(function(dt)
t += dt
local lookvector = camera.CFrame.LookVector
neck.C0 = CFrame.new(0, 0.8, 0) * CFrame.Angles(lookvector.Y, 0, 0)
if t > RATE then
-- don't loop to not spam remote events.
t = 0
--replication.ClientLook:FireServer(camera.CFrame.LookVector)
end
end)
How would this blend with animations that also control the head?
Would they get overridden?
If they do, how do I make sure they blend?
As an example, there could be a reload animation which makes your head turn, or aiming down sights.
After debugging it, I can safely say that no it doesn’t override the animations.
To actually override the animations, you need to delete the animate script from the player’s character immediately after it spawns.
local player = game:GetService("Players").LocalPlayer
local camera = workspace.CurrentCamera
local character = player.CharacterAdded:Wait()
local torso = character:FindFirstChild("Torso")
local RATE = 1/10
local t = 0
game:GetService("RunService").Heartbeat:Connect(function(dt)
t += dt
local lookvector = camera.CFrame.LookVector
torso:FindFirstChild("Neck").C0 = CFrame.new(0, 0.8, 0) * CFrame.Angles(lookvector.Y, 0, 0)
if t > RATE then
-- don't loop to not spam remote events.
t = 0
--replication.ClientLook:FireServer(camera.CFrame.LookVector)
end
end)
It already blends both together, like using a slash animation and then using cframe to basically make inverse kinematics out of an existing keyframe animation.
Roblox uses the Transform property to change the offset of the motord6d while playing animations, so if you want blending you can lerp your cframe to the cframe of the Transform property to create a blending effect if that makes sense
local cframe = ... -- the cframe you want to apply to C0
local newCFrame = cframe:Lerp(motor6d.Transform, 0.5)
motor6d.C0 = newCFrame
edit: didn’t put too much thought into this so you might wanna play around with it a little bit