self:set_attenuation

Client

Sets the attenuation curve factor of the audio-2d instance


Syntax

local status = self:set_attenuation(
    curve
)

Parameters

TypeNameDescription
floatcurveAttenuation curve factor to apply
Higher values cause volume to drop off more sharply with distance

Returns

TypeNameDescription
boolstatustrue on successful execution, false otherwise

Examples

Set a sharper attenuation curve
local entity = core.audio_2d.create("sounds/ambient.ogg")

entity:set_attenuation(2.0)

On this page