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

Is it possible to zoom out the camera with a script?

Asked by
1GlF 42
5 years ago

Selp explainatory. If you can zoom out, how?

0
show us what you have attempted to solve your question. User#5423 17 — 5y
0
You can set the field of view of the camera object gullet 471 — 5y

1 answer

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

Intro

In order to edit the Camera, you must first place it into the Scriptable Camera Type

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

After this, you have two options to change the "zoom" of the camera Note you can only make these changes using a LocalScript

Option 1: FieldOfView

The Camera has a Property named FieldOfView which can be set to any number between 1 and 120 (1 being close to the target, 120 being zoomed out) This works in the same way as a magnifying glass would. Examples can be seen here

Option 2: CFrame

You can set the Camera's CFrame when in Scriptable Mode to be farther out than it normally is by changing the original CFrame to a part that is farther than the default

camera.CFrame = CFrame.new(origin.Position, target.Position)

In the above example, the "origin" is whatever part you want to be looking out from, and the target, is the part you want the camera to face.

It should be noted that the CFrame.new() will only take Vector3 arguments, which is why we use the Position Property

There's also other CFrame alterations you can make with properties seen here

Ad

Answer this question