self:set_max_distance

Client

Sets the maximum distance at which the audio-2d instance can be heard


Syntax

local status = self:set_max_distance(
    pixels
)

Parameters

TypeNameDescription
floatpixelsMaximum audible distance in pixels between the audio instance and currently active camera
Beyond this distance, the audio becomes completely inaudible

Returns

TypeNameDescription
boolstatustrue on successful execution, false otherwise

Examples

Set the max audible distance of an audio-2d instance
local entity = core.audio_2d.create("sounds/ambient.ogg")

entity:set_max_distance(500.0)

On this page