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
| Type | Name | Description |
|---|---|---|
float | pixels | Maximum audible distance in pixels between the audio instance and currently active camera Beyond this distance, the audio becomes completely inaudible |
Returns
| Type | Name | Description |
|---|---|---|
bool | status | true on successful execution, false otherwise |
Examples
local entity = core.audio_2d.create("sounds/ambient.ogg")
entity:set_max_distance(500.0)