An audio effect that simulates sound attenuation based on the distance between the Audio and the AudioListenerComponent.

// @input Component.AudioComponent audio

var distanceEffect = script.audio.spatialAudio.distanceEffect;

distanceEffect.enabled = true;
distanceEffect.maxDistance = 200;
distanceEffect.minDistance = 50;
distanceEffect.type = Audio.DistanceCurveType.Linear;
interface DistanceEffect {
    enabled: boolean;
    maxDistance: number;
    minDistance: number;
    type: DistanceCurveType;
    getTypeName(): string;
    isOfType(type: string): boolean;
    isSame(other: ScriptObject): boolean;
}

Hierarchy (view full)

Properties

enabled: boolean

If enabled, the distance effect will be applied.

maxDistance: number

If the distance is higher than this value, the sound cannot be heard at all.

minDistance: number

If the distance is less than this value, the distance effect is not applied at all.

Curve type that describes how volume attenuates with distance.

Methods

  • Returns true if the object matches or derives from the passed in type.

    Parameters

    • type: string

    Returns boolean

  • Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

    Parameters

    Returns boolean