How to create this Camera Sway effect

  1. What do you want to achieve? Keep it simple and clear!
    I want to achieve the camera movement when looking around like the game Doors

Here is a example:
https://gyazo.com/cd41a65904e02372750a41cfedcfc8d2

Help is very appreciated.

2 Likes

Was actually gonna ask about this my self!

Seems as theres a offset along with a tween for the camera system.

Camera rotation!

How to detect if camera is rotating left or right? - #2 by nicemike40

you can check how to detect camera rotation over here, and then tween that.

1 Like

Could u maybe help me with tweening it because im not the best at making camera scripts?

1 Like

Give me a second to load up studio and check out some solutions, I’ll come back to you if I find a solution!

1 Like

alright thank you.


have u found any solution?


I found a solution. thanks for all you’re help

Here is the solution if u want to check it out:

--Services
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")

-- Variables
local LocalPlayer = Players.LocalPlayer
local Camera = workspace.CurrentCamera
local Turn = 0

-- Functions
local Lerp = function(a, b, t)
	return a + (b - a) * t
end;

-- Main
LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson -- First Person

RunService:BindToRenderStep("CameraSway", Enum.RenderPriority.Camera.Value + 25, function(deltaTime)
	local MouseDelta = UserInputService:GetMouseDelta()
	
	Turn = Lerp(Turn, math.clamp(MouseDelta.X, -4, 3), (15 * deltaTime))
	
	Camera.CFrame = Camera.CFrame * CFrame.Angles(0, 0, math.rad(Turn))
end)
3 Likes

So sorry! I fell asleep, i’m glad you could find the solution.

1 Like

Where do you put the script? Is it StarterCharacterScripts?

yes i put it in startercharacterscripts. sorry for late answer was taking a break.

Thank you. But is there any way to stop the glitch? If i turn my Graphics to full. Everytime i turn, the sway increases or switch down.

idk sorry i didnt answer i stopped playing roblox for the moment

1 Like