Camera

Where the Camera object is found

In an instance of the game, each client has its own Camera object associated with it. Camera objects exist only upon the viewer’s client, residing in that user’s local Workspace, and therefore cannot be edited directly from the server.

Each client’s particular Camera object can be accessed through the Workspace.CurrentCamera property of the Workspace on that client.

Note, Workspace.CurrentCamera can also be used to find the Camera object in Roblox Studio.

How the Camera object works

The Camera’s properties define the current view of the 3D game world. The most important of these being:

  • The Camera.CFrame property represents the position and orientation of the camera.

  • The Camera.Focus property represents the point the camera is looking at. It is important this property is set as it also represents where the game thinks you are in the world. Certain visuals will be more detailed and will update more frequently, depending on how close they are to the Focus. Roblox’s default camera scripts take care of this.

  • The Camera.CameraType property is read by the game’s camera scripts and determines how the Camera should update each frame.

  • The Camera.CameraSubject property is read by the game’s camera scripts and determines what object the Camera should follow.

  • The Camera.FieldOfView property represents the extent of the observable world visible.

How to work with the Camera

Roblox’s camera scripts update the Camera’s properties every frame dependent on the current Camera.CameraType. This means developers looking to control the Camera themselves have two options.

  1. Setting the Camera.CameraType property to ‘Scriptable’. When the Camera is in ‘Scriptable’ mode the default camera scripts will not update the camera. In most cases this is the easiest option.

  2. Replacing or modifying the default camera scripts in StarterPlayer.StarterPlayerScripts. This is only recommended for advanced developers.

Properties

The CFrame of the Camera, defining its position and orientation in the 3D world

The Humanoid or BasePart that is the Camera's subject

Specifies the CameraType to be read by the camera scripts

float [notreplicated]

Sets the angle of the Camera's diagonal field of view.

Sets the angle of the Camera's vertical field of view

Determines the FOV value of the Camera that’s invariant under viewport size changes.

Sets the area in 3D space that is prioritized by Roblox’s graphical systems

Toggles whether the Camera will automatically track the head motion of a player using a VR device

Sets the scale of the user’s head when using VR

float [notreplicated]

Sets the angle of the Camera's field of view along the longest viewport axis.

float [readonly] [notreplicated]

Describes the negative z-offset, in studs, of the Camera's near clipping plane

Vector2 [readonly] [notreplicated]

Describes the dimensions, in pixels, of the client’s viewport

Last updated