audio.position read/write property


Get or set the listener position in the world

This property expects a 3D vector, a table with the fields x, y, z set, representing the coordinates in space where the listener is.
For example, the position { x = 0, y = 0, z = 0 } sets the listener position in the center of the world (the default value)

If you don't want to use sound spatialization, just ignore this property

Example

local audio = require "audio" local console = require "console" local function printvector(v) -- Fancy Formatting console.writecolor("brightwhite", "Listener "..v..(#v < 7 and ":\t\t" or " :\t")) local value = "{ " for axis, val in pairs(audio[v]) do value = value..axis.." = "..val..", " end value = value:gsub(", $", " }") console.writecolor("cyan", value.."\n") end -- Get default listener position, direction, veolocity, worldup and cone printvector("position") printvector("direction") printvector("velocity") printvector("worldup") printvector("cone")