Camera Focus is a
DataType/CFrame that determines the area in 3D space the graphics engine will prioritize.
Certain graphical operations Roblox performs, such as updating lighting, can take a lot of time or computational effort to complete. Focus tells Roblox the area in 3D space to prioritize when performing such operations. For example dynamic lighting from objects such as
PointLight|PointLights may not render at distances far from the Focus.
The default Roblox camera scripts automatically set the Focus to follow the
Camera/CameraSubject (usually a
Humanoid). However, Focus will not be automatically updated in the following cases:
- When the
Camera/CameraTypeis set to ‘Scriptable’
- When the default camera scripts are not being used
In these cases, you should update Focus every frame, using
RunService/BindToRenderStep function at the ‘Camera’
Focus has no bearing on the positioning or orientation of the
Camera/CFrame|Camera.CFrame for this).
When the following code is placed inside a
LocalScript named ‘CameraScript’ parented to
StarterPlayerScripts|StarterPlayer.StarterPlayerScripts the default Roblox camera scripts are overwritten and replaced with a custom following camera.