How to make camera turn to the side of where mouse located

I want camera to move to the side where mouse located but not fully (Like a bit to this side)
I sadly don’t know how to make that

Can you be a little more specific to your question? Do you have any video examples to show us what you’re trying to achieve?

Okay, I want to know how to make somtehing similar like in game “Project Backrooms”
In lobby (where you starting game) are the thing I want to achieve, when you move mouse, camera moves to it a bit

I cant record video because I’m lagging so much that I can’t even normally write

I know this topic is a bit old, but I found a simple solution!

Here is the script, it is located in StarterPlayerScripts:

local mouse = game.Players.LocalPlayer:GetMouse()

repeat wait() until game.Players.LocalPlayer.Character

workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
workspace.CurrentCamera.CFrame = workspace.StartCamera.CFrame

while task.wait(0.01) do
	workspace.CurrentCamera.CFrame = workspace.StartCamera.CFrame * CFrame.Angles(-mouse.Y/5000,-mouse.X/5000,0)
end

Here is the file if you want to check it out:

CameraTest.rbxl (52.8 KB)

1 Like

Thank you very much, I wanted to know how this work but bad at math

I will try to explain, but I probably won’t do a great job.

mouse.X and mouse.Y return their on-screen position so if your screen is 500 pixels mouse.Y will return a number 0-500. I used that to rotate the camera but since you don’t want to rotate it by 500 degrees I divided it by 5000 which only moves it a tiny bit. In case you didn’t know this part of the code: workspace.CurrentCamera.CFrame = workspace.StartCamera.CFrame * CFrame.Angles()
is just the way to change a CFrames rotation. And this:

workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
workspace.CurrentCamera.CFrame = workspace.StartCamera.CFrame

Is just making the camera editable by the client.

Hopfully this made sense, lol.

1 Like

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