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
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’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.