Make camera sway upon idle/breathing effect that follows animation

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to make a kind of camera sway when the player is not moving so it looks like he is breathing,

  2. What is the issue? Include screenshots / videos if possible!
    I thought this post could be the solution, but I want it to follow the character’s animations as well, like in the following video:

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Changing the camera subject to the head, but when the player walks it just looks weird

1 Like

I would try to make it so that when you are idle, the camera subject is on your head, and when you begin to walk, the camera should return to normal.

You could try something like this:

local head = char.Head
local hrp = char.HumanoidRootPart
local hum = char.Humanoid

local ZERO_VEC = Vector3.zero

local function onRenderStepped()
    if hum.MoveDirection.Magnitude > 0 then
        local offset = hrp.CFrame:PointToObjectSpace(head.CFrame.Position)
        hum.CameraOffset = offset
    else
        hum.CameraOffset = ZERO_VEC
    end
end

game:GetService("RunService").RenderStepped:Connect(onRenderStepped)

You might want to use some sort of dampening constant.

You could also try getting a more accurate offset from the Neck motor 6d and then somehow using it

1 Like

For this, you’d use camera offset, and constantly tween it to the characters head.

task.wait(1.5)

local plr = game.Players.LocalPlayer
local char = plr.Character
local hum = char:WaitForChild("Humanoid")
local rootpart, head = char:WaitForChild("HumanoidRootPart"),char:WaitForChild("Head")

game:GetService("RunService"):BindToRenderStep("CameraOffset",Enum.RenderPriority.Camera.Value-1,function()
	game:GetService("TweenService"):Create(hum,TweenInfo.new(0.3),{CameraOffset = (rootpart.CFrame+Vector3.new(0,1.5,0)):pointToObjectSpace(head.CFrame.p)}):Play()
end)
1 Like