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 Edit

Pubfield CoordinateFrame CFrame Edit

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 Edit

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

Pubfield CameraType CameraType Edit

Defines how the camera will behave. More Info

Pubfield CoordinateFrame CoordinateFrame [deprecated] [hidden] Edit

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 Edit

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

Pubfield CoordinateFrame Focus Edit

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

Pubfield bool HeadLocked Edit

Pubfield float HeadScale Edit

Pubfield float NearPlaneZ [readonly] Edit

Pubfield Vector2 ViewportSize [readonly] Edit

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] Edit

Methods Edit

Pubmethod float GetLargestCutoffDistance(Objects ignoreList) Edit

Pubmethod float GetPanSpeed() Edit

Pubmethod Objects GetPartsObscuringTarget(Array castPoints, Objects ignoreList) Edit

Pubmethod CoordinateFrame GetRenderCFrame() Edit

Pubmethod float GetRoll() Edit

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() Edit

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

Pubmethod void PanUnits(int units) Edit

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

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) Edit

Pubmethod void SetRoll(float rollAngle) Edit

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) Edit

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

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) Edit

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) Edit

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

Protmethod bool Zoom(float distance) [RobloxScriptSecurity] Edit

Events Edit

Protevent RBXScriptSignal FirstPersonTransition(bool entering) [LocalUserSecurity] Edit

Pubevent RBXScriptSignal InterpolationFinished() Edit