Camera
Camera : Instance
Overview
The camera defines the viewpoint of viewing the 3D space and how the camera behaves.
Description
Camera plays a crucial role by managing the camera's position, orientation, field of view, and viewport size. It interacts with other game objects to provide seamless camera experiences for players. Its Lua scripting allows developers to create scenes, control player perspectives, and manipulate cameras according.
Properties
CFrame
CFrame
CFrame property in the Camera class defines the position and orientation of a camera in 3D space.
Code Samples
Focus
CFrame
Focus represents the position and direction the camera is looking at.
Code Samples
FieldOfView
number
FieldOfView sets the angle of the Camera's vertical field of view as a property in Camera.
Code Samples
ViewportSize
Vector2
ViewportSize is a property representing the dimensions, in pixels, of the viewport.
Code Samples
CameraType
Enum.CameraType
The CameraType property, of type Enum.CameraType, specifies the camera mode for game development. This allows developers to choose various camera modes or functions, like first-person, third-person, fixed, or subject-following cameras, for different use cases in their gameplay experiences.
Code Samples
Methods
ViewportPointToRay
Creates a ray from the camera position to the Viewpoint position.
Parameters
number
x
number
y
number
depth
Return
Ray
Code Samples
ScreenPointToRay
Creates a ray from the camera position to the ScreenPoint position.
Parameters
number
x
number
y
number
depth
Return
Ray
Code Samples
WorldToViewportPoint
This function returns the screen location and depth of a vector3 worldPoint and whether this point is visible on the screen or not.
Parameters
Vector3
WorldPoint
Return
Tuple
Code Samples
GetLargestCutoffDistance
The GetLargestCutoffDistance method, which can take either a list of instances to ignore, returns the largest cutoff distance as a Lua value, indicating how much the Camera needs to be pushed towards its Focus to ensure there are no obstructions between the Camera.Focus and Camera.CFrame.
Parameters
array
InIgnoreList
Return
Value