Need help making a camera like Apeirophobia

i may or may not have a script for this if you want it

1 Like

Yeah, that would be amazing. I have been looking for a few hours :sweat_smile:

1 Like

Yes, I know what it is, though I don’t know how to do the cf part.

1 Like

gotta find it first
then test it if theres no bugs then there ya go

1 Like

Alright, you don’t know how much I appreciate this thank you :sweat_smile:

1 Like

How do I add camera sway? - Help and Feedback / Scripting Support - DevForum | Roblox

3 Likes

Thanks, though it feels really choppy. So idk.

1 Like

there ya go

-- made by shade :/

wait(0.1)

local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local LocalPlayer = Players.LocalPlayer
local Mouse = LocalPlayer:GetMouse()

local Character = LocalPlayer.Character

if not Character then
	Character = LocalPlayer.CharacterAdded:Wait()
end

local Humanoid = Character.Humanoid
local HumanoidRootPart = Character.HumanoidRootPart
local Camera = workspace.CurrentCamera

local Val = 0 -- this part may look ugly but it gets the job done
local Val2 = 0
local Val3 = 0
local Val4 = 0
local Val5 = 0
local Val6 = 0
local Int = 10
local Int2 = 10
local vector3 = Vector3.new()

lerp = function(a, b, c) -- i love lerp
	return a + (b - a) * c
end

RunService.RenderStepped:Connect(function(DT)
	DT = DT * 60

	local magnitude = HumanoidRootPart and Vector3.new(HumanoidRootPart.Velocity.X, 0, HumanoidRootPart.Velocity.Z).Magnitude or 0
	local magnitude2 = math.min(magnitude, 30)

	if DT > 3 then
		Val = 0
		Val2 = 0
	else
		Val = lerp(Val, math.cos(tick() * 2 * math.random(10, 15)) * (math.random(5, 20) / 200) * DT, 0.05 * DT)
		Val2 = lerp(Val2, math.cos(tick() * 2 * math.random(5, 10)) * (math.random(2, 10) / 200) * DT, 0.05 * DT)
	end

	Camera.CFrame = Camera.CFrame * (CFrame.fromEulerAnglesXYZ(0, 0, math.rad(Val3)) * CFrame.fromEulerAnglesXYZ(math.rad(Val4 * DT), math.rad(Val * DT), Val2) * CFrame.Angles(0, 0, math.rad(Val4 * DT * (magnitude2 / 5))) * CFrame.fromEulerAnglesXYZ(math.rad(Val), math.rad(Val2), math.rad(Val2 * 10)))

	Val2 = math.clamp(lerp(Val2, -Camera.CFrame:VectorToObjectSpace((HumanoidRootPart and HumanoidRootPart.Velocity or Vector3.new()) / math.max(Humanoid.WalkSpeed, 0.01)).X * 0.08, 0.25 * DT), -0.25, 0.2)

	Val3 = lerp(Val3, math.clamp(UserInputService:GetMouseDelta().X, -5, 5), 0.25 * DT)
	Val4 = lerp(Val4, math.sin(tick() * Int) / 5 * math.min(1, Int2 / 10), 0.25 * DT)

	if magnitude > 1 then
		Val = lerp(Val, math.cos(tick() * 0.5 * math.floor(Int)) * (Int / 200), 0.25 * DT)
	else
		Val = lerp(Val, 0, 0.05 * DT)
	end

	if magnitude > 12 then
		Int = 20
		Int2 = 18
	elseif magnitude > 0.1 then
		Int = 12
		Int2 = 14
	else
		Int2 = 0
	end

	vector3 = lerp(vector3, Camera.CFrame.LookVector, 0.125 * DT)
end)
4 Likes

It works! Also is smooth and satisfying. Thank you so much! :smiley:

3 Likes

variables all over the place…
Looks decompiled

1 Like

my friend said the same thing eariler when he wanted a better camera bob

This is very good although, for me it shakes alot when i’m standing still, does that happen to you?
Do you know why this happens, what the variables for it is or anything that causes this.

no he does not know (because it’s decompiled) but I am guessing it’s from when magnitude is less than 1, so Val (funny name for a variable right) gets lerped with deltaTime etc

3 Likes

I found that out aswel, script looked kinda suspicious too. Thanks

it’s not decompiled???

dont know where you got that from.

Maybe because this entire line of (decompiled) code is nearly 1:1 to yours except for a few variable names? Don’t steal code and claim it as your own.

7 Likes

To add on, if it wasn’t decompiled they should know what variables mean not just to be “trusted” with them.
I could be wrong here, but yeah.

2 Likes

Went into the game and decompiled it myself, just as you did, except you took credit for the making of the code.

6 Likes

I’m a bit confused, what do you mean by decompiled here?

He used an exploit to view and get the scripts from the game.

2 Likes