Audio 3D

self:set_dimension

Client

Sets the dimension of the audio-3d instance

Syntax

local status = self:set_dimension(
    dimension
)

Audio is only heard from the dimension it is in.

  • Hearing — the client mutes the instance while its active camera is in a different dimension. Playback keeps running while muted, so the timeline stays in sync.
  • Attached — an instance parented to another entity always follows its parent's dimension and cannot set its own, the call raises an error. Detaching it keeps the dimension it had.

Parameters

TypeNameDescription
intdimensionDimension id to apply
Must be within 0 to 65535

Returns

TypeNameDescription
boolstatustrue on successful execution, false otherwise

Examples

Set the dimension of an audio-3d instance
local entity = core.audio_3d.create("sounds/ambient.ogg", true)

entity:set_dimension(1)

On this page