audio.direction read/write property


Get or set the listener direction 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 looking at
For example, the direction { x = 0, y = 0, z = -1 } means the listener is looking at the screen (the default direction)

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")