Curve Falloff { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The Falloff property of the SoundEvent class represents the falloff curve for the sound. This curve determines how the sound's volume decreases over distance, allowing for more realistic audio attenuation in a 3D environment.

Usage

To use the Falloff property, you can assign a Curve object that defines the desired attenuation behavior. This property is part of the DistanceAttenuation toggle group, meaning it is only relevant if distance attenuation is enabled for the sound event.

Example

// Example of setting the Falloff property
SoundEvent soundEvent = new SoundEvent();
Curve falloffCurve = new Curve();

// Configure the curve as needed
falloffCurve.AddKey(0, 1); // Full volume at the start
falloffCurve.AddKey(1, 0); // No volume at the end

soundEvent.Falloff = falloffCurve;

// Ensure DistanceAttenuation is enabled
soundEvent.DistanceAttenuation = true;