How would I make this camera effect? | SNaJ II

Hey! I’m in the middle of making a FNaF styled game, and found a really cool feature on another game. I’m asking any scripture on how I’d make this:

https://gyazo.com/0009631dd0d88d02e5e63f4064d83df7

Notice how the camera moves with the mouse? that’s my question!
Thank you!

You can use RunService | Roblox Creator Documentation to position the camera every frame. Rotate it from some base rotation, based on the Mouse | Roblox Creator Documentation position.

Or, you could make the camera Camera | Roblox Creator Documentation Scriptable, and just rotate it whenever the mouse moves.

When I say “rotate it”, I mean change its CFrame.

How would I do this? (Not saying provide the script, just provide a few more steps.) Sorry, I’m not the best scripter when it comes to the camera.

Most of those links have pretty detailed examples of different ways to rotate the camera.

But the second way, with a Scriptable camera, goes something like:

  1. Set the CameraType to Scriptable.
  2. Determine your “starting” CFrame. This could just be a part you place where you want the camera to be, and you can do local startCFrame = workspace.Part.CFrame or something.
  3. Bind a function to the Mouse.Move event that…
  4. Determines the offset of the mouse from the middle of the screen (like Mouse.X - halfTheScreenWidth), and…
  5. Sets the Camera.CFrame to startCFrame * CFrame.Angles(0, SOME_NUMBER * mouseOffset / halfTheScreenWidth, 0)
1 Like