Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why the camera does not focus on the coordinates?

Asked by 7 years ago
Edited 7 years ago

Google Translator,sorry


local camera = workspace.CurrentCamera workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable workspace.CurrentCamera.CameraSubject = workspace.focushere while wait() do camera.CoordinateFrame = CFrame.new(54.284, 77.972, -159.44) camera.Focus = CFrame.new(workspace.focushere.Position) end

What's wrong? why the camera does not focus on the coordinates?

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

In the past, changing this property would automatically make the camera look towards it, though this is no longer always the case. .Focus is used to make camera focus to the objects near that position, to see those objects more detailed. You need to use .CoordinateFrame to make Camera look at that position. To make camera look at somewhere, you can use:

local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = workspace.focushere

while wait() do
    camera.CoordinateFrame = CFrame.new(54.284, 77.972, -159.44)
    camera.CoordinateFrame = CFrame.new(camera.CoordinateFrame.p, workspace.focushere.Position)
end

CFrame.new(FirstPos, SecondPos) will create a rotation to make a part(Or camera) which has same position with FirstPos turn its face to SecondPos.

IMPORTANT NOTE: Make sure your script is a LocalScript and in StarterPack or StarterGui

Ad

Answer this question