Why Is The Camera Orientation Not Changing?

I’m trying to make a basic security camera-like system where the camera faces in a certain orientation. Only problem is the position stays but the orientation is not following the Look Vector. Am I doing something wrong?


local Camera = game.Workspace.CurrentCamera

local UserInputService = game:GetService("UserInputService")

--Room Position Coordinates
local TestCamPos = Vector3.new(0, 10, 0)
local TestCamLookAt = Vector3.new(0, 0, 0)
local TestCameraCFrame = CFrame.new(TestCamPos, TestCamLookAt)

UserInputService.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.E then
		print("Pressed")
		Camera.CameraType = 6 -- Scriptable
		Camera.CFrame = TestCameraCFrame -- Correctly finds the camera position but fails to look in the desired direction
	end
end)

if Camera then
	print("Cam Exists")
end
3 Likes

I’m not sure what’s going on with your code, but why set CameraType to a number?

I would use CFrame.lookAlong() to look along a look vector.

1 Like

Camera type 6 is the same as “Scriptable”

Which direction does the camera point to instead of the desired direction?

I would also highly recommend using enums instead of numbers as they are descriptive/readable, in this case for your camera type:
Camera.CameraType = Enum.CameraType.Scriptable

I checked the docs and I am aware, but it just makes it less readable and intuitive.

I’ve concluded that using LookVector doesn’t control the direction your camera is oriented, but rather what coordinates it faces towards, so it’s fixed now.

LookVector IS the direction your camera is facing.

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