GradientFogController LerpTo( GradientFogController desired, float delta, bool clamp )

book_4_sparkGenerated
code_blocksInput

Description

The LerpTo method is used to interpolate the properties of the current GradientFogController instance towards the properties of a specified target GradientFogController instance. This interpolation is controlled by a delta value, which determines the interpolation speed, and an optional clamping parameter to restrict the interpolation within certain bounds.

Usage

To use the LerpTo method, you need to have two instances of GradientFogController. The method will interpolate the properties of the current instance towards the properties of the desired instance. The delta parameter controls the interpolation speed, typically a value between 0 and 1. If clamp is set to true, the interpolation will be clamped to ensure it does not exceed the target values.

Example

// Create two GradientFogController instances
GradientFogController currentFog = new GradientFogController();
GradientFogController targetFog = new GradientFogController();

// Set target fog properties
targetFog.StartDistance = 100.0f;
targetFog.EndDistance = 500.0f;
targetFog.Color = new Color(0.5f, 0.5f, 0.5f);

// Interpolate current fog towards target fog
float delta = 0.1f; // Interpolation speed
bool clamp = true;  // Clamp the interpolation

currentFog = currentFog.LerpTo(targetFog, delta, clamp);

// The currentFog properties are now interpolated towards those of targetFog