How do i make a camera bobbing?

So if you learned geometry, sine is the ratio of the side opposite to an angle in a right triangle to the hypotenuse and cosine is basically sine but adjacent to the hypotenuse but pretty much the same.

But like i dont really know how to script… So…?

So…

  • Learn with the Roblox Creator Documentation (and various other resources).
  • Or hire someone to do it for you with the talent hub.
  • Or maybe if you have a good scripter friend they’ll be quite nice and try it for free.
  • There’s also free models/plugins you can have a look at and modify (be sure they don’t have viruses).
  • And, relatively unlikely, but sometimes people give you code on here too in replies. But for something a bit time-consuming such as custom camera bobbing, almost certainly not, hence the above.

There’s usually some YouTube tutorial for this stuff too, but I assume you’ve tried those already and came here after they didn’t work.

Best of luck!

P.S. Probably more specifically useful:

In this video, if the camera’s position values was calibrated vs the head’s position as the head “bobs” normally … the camera would follow it. It really looks like that’s what I’m seeing here, as it also moves a bit sideways, just as the head movement would be.

If not you may want to try out a mod or two …
This looks like something you may like: Creating a Simple, Realistic Camera (With View Bobbing, Dynamic Blur, & Sprinting)

Or possibly … EZ Camera Shake ported to Roblox
This one is simply epic for camera effects. You would need to script this in while you move.

2 Likes

is hiring someone costs robux? And what hiring someone does? wait will i get free robux from it…?

What? I don’t know how you inferred that from my comment…
Hiring someone from the Talent Hub means you pay them Robux to help create what you want, so long as it can be done. I can’t make it any simpler than that.

--CBob script with a tilt. org.by:IAmDevForumMember
task.wait(3) --StarterCharacterScripts.LocalScript
local Workspace = game:GetService("Workspace")
local RunService = game:GetService("RunService")
local LocalPlayer = game:GetService("Players").LocalPlayer
local UserInputService = game:GetService("UserInputService")
local Root = LocalPlayer.Character:WaitForChild("HumanoidRootPart")
local Mouse, Camera  = LocalPlayer:GetMouse(), Workspace.CurrentCamera
local angleX, x, y, tilt, vX, vY, sX, sY = 0, 0, 0, 0, 0, 0, 10, 10
local TouchEnabled = UserInputService.TouchEnabled
--* UserInputService.MouseIconEnabled = flase
local randomX, randomY = nil, nil
local function lerp(v1, v2, t)
	return v1 + (v2 - v1) * t
end --rewrite.by:2112Jay

RunService.RenderStepped:Connect(function(dt)
	local velocity = Root.Velocity.magnitude
	if velocity > 0.02 then dt *= 60 randomX = math.random(1, 2) randomY = math.random(1, 2) --x(10,15), y(5,10)
		vX = dt <= 2 and lerp(vX, math.cos(tick() * 0.5 * randomX) * (math.random(5, 20) / 200) * dt, 0.05 * dt) or 0
		vY = dt <= 2 and lerp(vY, math.cos(tick() * 0.5 * randomY) * (math.random(2, 10) / 200) * dt, 0.05 * dt) or 0
		
		Camera.CFrame *= CFrame.Angles(0, 0, math.rad(angleX))
			* CFrame.Angles(math.rad(math.clamp(x * dt, -0.15, 0.15)), math.rad(math.clamp(y * dt, -0.5, 0.5)), tilt)
			* CFrame.Angles(math.rad(vX), math.rad(vY), math.rad(vY * 10))
		
		tilt = math.clamp(lerp(tilt, -Camera.CFrame:VectorToObjectSpace((Root and Root.Velocity or 
			Vector3.new()) / math.max(LocalPlayer.Character.Humanoid.WalkSpeed, 0.01)).X * 0.05, 0.1 * dt), -0.05, 0.05)
		
		if not TouchEnabled and dt < 2 then
			angleX = lerp(angleX, math.clamp(UserInputService:GetMouseDelta().X / dt * 0.15, -2.5, 2.5), 0.25 * dt)
		end x = lerp(x, math.sin(tick() * sX) / 5 * math.min(1, sY / 10), 0.25 * dt)
		y = velocity > 1 and lerp(y, math.cos(tick() * 0.5 * math.floor(sX)) * (sX / 200), 0.25 * dt) or lerp(y, 0, 0.05 * dt)
		sX, sY = velocity > 12 and 20 or (velocity > 0.1 and 12 or 0), velocity > 0.1 and 18 or (velocity > 0.1 and 14 or 0)
	end
end)

Not totally what you wanted. Edit added: “if velocity > 0.02” for no movement when still yet will show when floating. Mess with the randomX and Y for more bobbing/tilt effect if you like. “UserInputService.MouseIconEnabled = flase”, Option also …

5 Likes

but it works inverted when i am the one hired right?

1 Like

it works perfect bc it changes the speed of it when sprinting. How can i change the shaking power when standing?
And also thank you very very very very very very very very very very much for this script but you should tell me how to decrease the shaking while standing and also the shaking speed

oh btw while making a script put credits at the start

The values can be changed. Just mess around with it. That program started off from a script I saw here, . Modified, and restructured to be more efficient and readable. I tried to find one like the video view.

Found it again … this was posted by: IAmDevForumMember
In a much larger form … I tweaked it about as much as I could.

1 Like

i think i just figured it out… so randomX and randomY are for the shaking right? so if i make them small it wont be a big shake

yep, it should and I need 30 words to reply here.

1 Like

also would you help me if i will make any other topic? but you dont need to.

I think Roblox wants you to make a new topic for each question.

1 Like

Also did you edit the original script?

The original script is from this post … Configurable Head Bobbing Script
Super hard to read but also super good programming with lerp.
I gave it some love and rewrote it …

2 Likes

I liked the previous version bc this one is not smooth at all.

That is the same version with different settings.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.