Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why the camera does not focus on the coordinates?

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

✓ Accepted answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.