FANDOM


The Camera class represents a view of the game world. The Camera class inherits from Instance.

Camera objects are not replicated to the server and exist only on the client of each player. Because they are stored locally, they cannot be accessed by ExplorerImageIndex 6Scripts; ExplorerImageIndex 18LocalScript must be used instead to get the player's camera. The player's local camera can be given by the CurrentCamera property of ExplorerImageIndex 19Workspace.

Game developers can create parts that can only be seen by one player via the camera by putting parts within the camera. Only the player will collide with such parts, and such parts cannot be removed using a Script.

Scripts and LocalScripts placed into the camera do not run. Such things can only happen to parts in cameras if they are controlled by a LocalScript elsewhere.

Properties

Pubfield CoordinateFrame CFrame

The current position and rotation of the Camera. For most CameraTypes, the rotation is set such that the CoordinateFrame lookVector is pointing at the Focus.

Pubfield Instance CameraSubject

Where the Camera's focus is. Any rotation of the camera will be about this subject.

Pubfield CameraType CameraType

Defines how the camera will behave. More Info

Pubfield CoordinateFrame CoordinateFrame [deprecated] [hidden]

The current position and rotation of the Camera. For most CameraTypes, the rotation is set such that the CoordinateFrame lookVector is pointing at the Focus.

Pubfield float FieldOfView

The current angle, or width, of what the camera can see. Current acceptable values are from 20 degrees to 80.

Pubfield CoordinateFrame Focus

The current CoordinateFrame that the camera is looking at. Note: it is not guaranteed that the camera is always looking here.

Pubfield bool HeadLocked

Pubfield float HeadScale

Pubfield float NearPlaneZ [readonly]

Pubfield Vector2 ViewportSize [readonly]

Holds the x,y screen resolution of the viewport the camera is presenting (note: this can differ from the AbsoluteSize property of a full screen gui).

Pubfield CoordinateFrame focus [deprecated]

Methods

Pubmethod float GetLargestCutoffDistance(Objects ignoreList)

Pubmethod float GetPanSpeed()

Pubmethod Objects GetPartsObscuringTarget(Array castPoints, Objects ignoreList)

Pubmethod CoordinateFrame GetRenderCFrame()

Pubmethod float GetRoll()

Returns the camera's current roll. Roll is defined in radians, and is stored as the delta from the camera's y axis default normal vector.

Pubmethod float GetTiltSpeed()

Pubmethod void Interpolate(CoordinateFrame endPos, CoordinateFrame endFocus, float duration)

Pubmethod void PanUnits(int units)

Pubmethod Ray ScreenPointToRay(float x, float y, float depth = 0)

Takes a 2D screen position and produces a Ray object to be used for 3D raycasting. Input is x,y screen coordinates, and a (optional, defaults to 0) z position which sets how far in the camera look vector to start the ray origin.

Pubmethod void SetCameraPanMode(CameraPanMode mode = Classic)

Pubmethod void SetRoll(float rollAngle)

Sets the camera's current roll. Roll is defined in radians, and is stored as the delta from the camera's y axis default normal vector.

Pubmethod bool TiltUnits(int units)

Pubmethod Ray ViewportPointToRay(float x, float y, float depth = 0)

Same as ScreenPointToRay, except no GUI offsets are taken into account. Useful for things like casting a ray from the middle of the Camera.ViewportSize

Pubmethod Tuple WorldToScreenPoint(Vector3 worldPoint)

Takes a 3D position in the world and projects it onto x,y coordinates of screen space. Returns two values, first is a Vector3 that has x,y position and z position which is distance from camera (negative if behind camera, positive if in front). Second return value is a boolean indicating if the first argument is an on-screen coordinate.

Pubmethod Tuple WorldToViewportPoint(Vector3 worldPoint)

Same as WorldToScreenPoint, except no GUI offsets are taken into account.

Protmethod bool Zoom(float distance) [RobloxScriptSecurity]

Events

Protevent RBXScriptSignal FirstPersonTransition(bool entering) [LocalUserSecurity]

Pubevent RBXScriptSignal InterpolationFinished()