Camera
Defines the viewpoint used to render the scene on a client.
- Creatable
Instance.new("Camera")- Inherits
- Instance
- Replication
- Standard
Behavior
Camera defines the client viewpoint. Access the active camera through
workspace.CurrentCamera in a LocalScript.
Set CameraType to Scriptable before controlling CFrame. Other camera modes
update the transform automatically.
Summary
The camera position and orientation in world space.
The instance followed by automatic camera modes, normally the character's Humanoid.
The camera control mode.
Compatibility spelling of CFrame.
Bit mask selecting which geometry visibility layers the camera renders.
The vertical field of view, in degrees.
The reference frame used for level-of-detail and lighting calculations.
Whether the rendered camera includes tracked head movement.
The distance of the near clipping plane from the camera.
The view size used for orthographic projection.
Whether the camera uses perspective or orthographic projection.
The maximum rendering distance from the camera.
The read-only dimensions of the rendered viewport, in pixels.
Returns this instance if it is an ExecutionGroup.
Returns the camera's projection matrix as a numeric array.
Returns the camera transform used for rendering.
Returns the camera's roll angle in radians.
Interpolates the camera transform and focus toward the supplied endpoints over duration seconds.
Returns a Ray through a screen position, accounting for the interface inset.
Sets a custom projection matrix.
Sets the camera's roll angle in radians.
Stops the camera's active interpolation.
Returns a ray through a viewport position without applying the interface inset.
Projects a world position into screen coordinates and reports whether it is on screen.
Projects a world position into viewport coordinates and reports whether it is within the viewport.
Fires when the camera interpolation finishes.
Properties
CFrame
Camera.CFrame: CFrame = CFrame.new(0, 0, 0)The camera position and orientation in world space. Automatic camera modes may overwrite assigned values on the next frame.
CameraSubject
Camera.CameraSubject: Instance? = nilThe instance followed by automatic camera modes, normally the character's Humanoid. Ignored in Scriptable mode.
CameraType
Camera.CameraType: Enum.CameraType = Enum.CameraType.CustomThe camera control mode. Scriptable uses the transform supplied by scripts. The current native controller treats the other stored modes as automatic camera control; assigning their names does not select separate tracking implementations.
CoordinateFrame
Camera.CoordinateFrame: CFrameCompatibility spelling of CFrame. Use CFrame in new code.
CullingMask
Camera.CullingMask: number = 4294967295Bit mask selecting which geometry visibility layers the camera renders.
FieldOfView
Camera.FieldOfView: number = 70The vertical field of view, in degrees.
Focus
Camera.Focus: CFrame = CFrame.new(0, 0, 0)The reference frame used for level-of-detail and lighting calculations.
HeadLocked
Camera.HeadLocked: boolean = trueWhether the rendered camera includes tracked head movement.
NearClip
Camera.NearClip: number = 0.05The distance of the near clipping plane from the camera.
OrthographicSize
Camera.OrthographicSize: number = 50The view size used for orthographic projection.
ProjectionType
Camera.ProjectionType: Enum.CameraProjection = Enum.CameraProjection.PerspectiveWhether the camera uses perspective or orthographic projection.
ViewDistance
Camera.ViewDistance: number = 2000The maximum rendering distance from the camera.
ViewportSize
Camera.ViewportSize: Vector2 = Vector2.new(0, 0)The read-only dimensions of the rendered viewport, in pixels.
Methods
GetExecutionGroup
Camera:GetExecutionGroup(): ExecutionGroup?Returns this instance if it is an ExecutionGroup. Otherwise returns the nearest ancestor ExecutionGroup, or nil when no group contains the instance.
GetProjectionMatrix
Camera:GetProjectionMatrix(): { number }Returns the camera's projection matrix as a numeric array.
GetRenderCFrame
Camera:GetRenderCFrame(): CFrameReturns the camera transform used for rendering. It may differ from CFrame during interpolation.
GetRoll
Camera:GetRoll(): numberReturns the camera's roll angle in radians.
Interpolate
Interpolates the camera transform and focus toward the supplied endpoints over duration seconds.
ScreenPointToRay
Camera:ScreenPointToRay(x: number, y: number, depth: number?): RayReturns a Ray through a screen position, accounting for the interface inset.
SetProjectionMatrix
Camera:SetProjectionMatrix(matrix: { number }?): ()Sets a custom projection matrix. Passing nil restores the standard projection.
SetRoll
Camera:SetRoll(rollAngle: number): ()Sets the camera's roll angle in radians.
StopInterpolation
Camera:StopInterpolation(): ()Stops the camera's active interpolation.
ViewportPointToRay
Camera:ViewportPointToRay(x: number, y: number, depth: number?): RayReturns a ray through a viewport position without applying the interface inset.
WorldToScreenPoint
Projects a world position into screen coordinates and reports whether it is on screen.
WorldToViewportPoint
Projects a world position into viewport coordinates and reports whether it is within the viewport.
Events
InterpolationFinished
Camera.InterpolationFinished: RBXScriptSignalFires when the camera interpolation finishes.
Inherited members
- Properties
- ArchivableClassNameNameParent
- Methods
- AddComponent()AddTag()ClearAllChildren()ClearTags()Clone()Destroy()FindFirstAncestor()FindFirstAncestorOfClass()FindFirstAncestorWhichIsA()FindFirstChild()FindFirstChildOfClass()FindFirstChildWhichIsA()FindFirstDescendant()GetAttribute()GetAttributeChangedSignal()GetAttributes()GetChildren()GetComponent()GetComponentChangedSignal()GetComponents()GetDebugId()GetDescendants()GetFullName()GetPropertyChangedSignal()GetReferencing()GetTags()HasComponent()HasTag()IsA()IsAncestorOf()IsDescendantOf()RemoveComponent()RemoveTag()SetAttribute()WaitForChild()
- Events
- AncestryChangedAttributeChangedChangedChildAddedChildRemovedDescendantAddedDescendantRemovingDestroying
Example
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = CFrame.new(0, 10, 20)