natiny.audio.create_listener
natiny.audio.create_listener() -> listener
Creates a listener entity and makes it the active listener.
Returns
| Type | Description |
|---|---|
number |
Listener handle, also usable as an entity handle |
Example
local listener = natiny.audio.create_listener()
Notes
- A listener can be moved, rotated or parented with
natiny.entity. Its forward direction is local-Z; scale does not affect listening direction. - Creating another listener makes the new one active. Without an active listener, spatial sources are silent and non-spatial sources are unaffected.
- Lua raises an error if the listener cannot be created.