Description
The LinearAttenuation
property represents the linear term in the light attenuation equation for a SceneLight
object. This property affects how the intensity of the light diminishes over distance. A higher value will cause the light to attenuate more quickly as it moves away from the source.
Usage
To use the LinearAttenuation
property, you can get or set its value on a SceneLight
instance. Adjusting this value allows you to control how the light's intensity decreases with distance, which can be useful for creating realistic lighting effects in a scene.
Example
// Create a new SceneLight object
SceneLight myLight = new SceneLight();
// Set the linear attenuation to a specific value
myLight.LinearAttenuation = 0.5f;
// Get the current linear attenuation value
float currentAttenuation = myLight.LinearAttenuation;
// Output the current linear attenuation
// Note: Avoid using Console.WriteLine in Sandbox
// Instead, use in-game debugging tools or UI elements to display values
// Debug.Log($"Current Linear Attenuation: {currentAttenuation}");