Camera

Show Deprecated
Not Replicated

The Camera object defines a view of the 3D world. In a running experience, each client has its own Camera object which resides in that client's local Workspace, accessible through the Workspace.CurrentCamera property.

The most important camera properties are:

  • CFrame which represents the position and orientation of the camera.

  • CameraType which is read by the experience's camera scripts and determines how the camera should update each frame.

  • CameraSubject which is read by the experience's camera scripts and determines what object the camera should follow.

  • FieldOfView which represents the visible extent of the observable world.

  • Focus which represents the point the camera is looking at. It's important this property is set, as certain visuals will be more detailed and will update more frequently depending on how close they are to the focus point.

See Customizing the Camera for more information on how to adjust and customize the camera's behavior.

Storing Multiple Cameras

Note that when changing Workspace.CurrentCamera to a new Camera, all other Cameras directly descending from Workspace will be destroyed. If you need to store multiple cameras and swap between them on demand, it's recommended that you store them in a Folder or Model under Workspace, inside which they will remain even when CurrentCamera is changed.

Summary

Properties

Properties inherited from PVInstance

Properties

Methods

Methods inherited from PVInstance

Methods

Properties

CFrame

Read Parallel

CameraSubject

Read Parallel

CameraType

Read Parallel

DiagonalFieldOfView

Not Replicated
Read Parallel

FieldOfView

Read Parallel

FieldOfViewMode

Read Parallel

Focus

Read Parallel

HeadLocked

Read Parallel

HeadScale

Read Parallel

MaxAxisFieldOfView

Not Replicated
Read Parallel

NearPlaneZ

Read Only
Not Replicated
Read Parallel

VRTiltAndRollEnabled

Read Parallel

ViewportSize

Read Only
Not Replicated
Read Parallel

Methods

GetPartsObscuringTarget

Instances

Parameters

castPoints: Array
ignoreList: Instances

Returns

Instances

GetRenderCFrame


Returns

GetRoll


Returns

Code Samples

Camera:GetRoll

local currentRoll = math.deg(workspace.CurrentCamera:GetRoll()) -- Gets the current roll of the camera in degrees.
if currentRoll ~= 20 then
workspace.CurrentCamera:SetRoll(math.rad(20)) -- If the camera isn't at 20 degrees roll, the roll is set to 20 degrees.
end

ScreenPointToRay

Write Parallel

Parameters

depth: number
Default Value: 0

Returns

SetRoll

()

Parameters

rollAngle: number

Returns

()

ViewportPointToRay

Write Parallel

Parameters

depth: number
Default Value: 0

Returns

WorldToScreenPoint

Write Parallel

Parameters

worldPoint: Vector3

Returns

WorldToViewportPoint

Write Parallel

Parameters

worldPoint: Vector3

Returns

ZoomToExtents

()

Parameters

boundingBoxCFrame: CFrame
boundingBoxSize: Vector3

Returns

()

Events

InterpolationFinished