Lock camera in one position

I want to CFrame the camera

I’ve looked at devforum posts, read the developer articles on the Camera, watched YouTube videos, and used other mediums.

I set my camera to scriptable and CFramed the camera in a LocalScript, but it still hasn’t worked. How do I do this?

Can you share the code you wrote so that we are able to take a look at it for you? :slight_smile:

I’d say set the camera’s Camera.CameraType to Enum.CameraType.Track or Enum.CameraType.Fixed

I deleted the code where I tried CFraming the camera already, and this is what I have now:

local camera = workspace.CurrentCamera

camera.CameraType = Fixed
camera.CameraSubject = game.workspace.cameraLookAt

cameraLookAt is a part in the workspace. This is in a Localscript under StarterPlayerScripts. When I run the game, the camera’s subject is still the humanoid, and type is still fixed

Make sure you are setting the CameraType using an Enum. CameraSubject does not have any effect on scriptable cameras. You will have to set the CFrame yourself.

It does have an effect when I’m using other camera types, which is what I’m trying to do.

How do I reference the CameraType correctly? enum.fixed?

You set the type by saying Enum.CameraType.Fixed

1 Like

Although you marked a solution already, it is likely not your desired solution as the camera will be fixed around the center of the workspace.

Your original issue as described stems from the CurrentCamera properties being overridden by the built-in camera controller on startup. Adding a simple wait to the beginning of your code fixes the issue and gives the intended result.

repeat wait() until workspace.CurrentCamera

local camera = workspace.CurrentCamera

camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = (workspace.cameraLookAt.CFrame + Vector3.new(0, 0, 10))

CameraManipulation.rbxl (18.2 KB)

2 Likes

Yeah, that works much better.

Thank you

1 Like

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