Description
The FieldOfView
property of the CameraComponent
class represents the field of view (FOV) of the camera in degrees. This property determines how wide the camera's view is, affecting how much of the scene is visible at any given time. A larger field of view allows more of the scene to be visible, while a smaller field of view focuses on a narrower area.
Usage
To adjust the field of view of a camera in your scene, you can set the FieldOfView
property to a value between 1 and 179 degrees. This range ensures that the camera's view is neither too narrow nor too wide, which could lead to visual distortions or artifacts.
Example
// Create a new CameraComponent
CameraComponent camera = new CameraComponent();
// Set the field of view to 90 degrees
camera.FieldOfView = 90.0f;
// Access the current field of view
float currentFOV = camera.FieldOfView;
// Print the current field of view
// Note: Avoid using Console.WriteLine in Sandbox
// Instead, use a logging system or in-game UI to display information
// Log.Info($"Current Field of View: {currentFOV}");