I've been trying to make a "menu", so I was going to place the camera in a spot, have it look at a point, and start from there. When I got to the point of setting where the camera looks, I ran into a problem. Using Camera.Focus
and Camera.CameraSubject
won't work for me. (I tried them both separately)
This is in a local script in StarterPlayerScripts. I've tried looking at the wiki and youtube but I can't figure it out. Here is my code:
local player = script.Parent.Parent local character = player.Character local humanoid = character.Humanoid local cam = game.Workspace.CurrentCamera function setUpCam() local camNewLocation = game.Workspace.CameraLocationOne.CFrame cam.CameraType = "Scriptable" cam.CFrame = camNewLocation cam.Focus = game.Workspace.CameraFocusOne.CFrame end wait(3) setUpCam()
It's probably something very simple that I'm missing, as I'm new to scripting...
Thanks! -Kyleo
The Scriptable camera does not allow for Focus to be set independent of the Coordinate Frame.
Use the following format for setting Focus on a Scriptable camera:
Given two Vector3 values:
camera.CoordinateFrame = CFrame.new(PositionCameraIS, PositionCameraPoints)
Given two CFrame values:
camera.CoordinateFrame = (CFramePositionIS, CFrameCameraPoints)
So in your case:
cam.CameraType = Enum.CameraType.Scriptable cam.CoordinateFrame = (camNewLocation, game.Workspace.CameraFocusOne.CFrame)