Is there like a good way?
COMMUNITY QUESTION
How do I make a Camera Bob?
3 answers
Here, I just made one. It's a little bit wonky, but should do fine for you:
wait(0.1)
local cam = game.Workspace.CurrentCamera
local player = game.Players.LocalPlayer
local char = player.Character
local rs = game:GetService("RunService")
local lastTick = tick()
local t = 0
local headPos = char.Torso.Neck.C0
local running = false
char.Humanoid.Running:connect(function(speed)
running = speed > 0
end)
while true do
rs.RenderStepped:wait()
local dt = tick()-lastTick
if running then
t = t+dt
char.Torso.Neck.C0 = headPos * CFrame.new(math.cos(t*8)*0.1, 0, math.abs(math.sin(t*8))*0.1)
local look = cam.CoordinateFrame.lookVector
cam.CoordinateFrame = CFrame.new(cam.CoordinateFrame.p, cam.CoordinateFrame.p+look) * CFrame.Angles(0, 0, math.rad(math.cos(t*8)))
end
lastTick = tick()
end
Notes:
- It must be a local script
- It goes in StarterGui
Please help! I am wondering this too!
Hey ya, I've made a script, sorry for 6 years late lol
local Camera = game.Workspace.CurrentCamera
local Player = game.Players.LocalPlayer
local Humanoid = workspace:WaitForChild(Player.Name).Humanoid
local Head = Humanoid.Parent.Head
local HumanoidRootPart = game.Workspace[Player.Name].HumanoidRootPart
local Mouse = Player:GetMouse()
while true do
wait()
Humanoid.CameraOffset = Head.Position - HumanoidRootPart.Position + Vector3.new(0, -1.5, -1)
end
Basically, it changes the humanoid offset to the head position minus humanoid root part position, and then the camera is close to the head, you can change the position how you'd like to with just simply changing the Vector3 value. No problem :)
This discussion is preserved as it was. New answers, comments, and votes are closed.
