melonJS
    Preparing search index...

    Function listenerOrientation

    Get or set which way the listener faces, in WORLD coordinates.

    Two vectors: the direction the listener looks along, and which way is up for it. This is what decides left from right, so a game that only moves the listener around a flat plane can leave it alone.

    World up in melonJS is (0, -1, 0), because render space is Y-down, and that is what to pass here. The conversion to Web Audio's Y-up is applied for you, which matters: handing Web Audio a Y-down up vector mirrors the stereo image, since it derives right from forward × up.

    forward x, or omitted to read

    forward y

    forward z

    up x

    up y

    up z

    the current [fx, fy, fz, ux, uy, uz] when reading

    // face the way the player is walking, with melonJS world up
    audio.listenerOrientation(dir.x, dir.y, 0, 0, -1, 0);
    • Returns [number, number, number, number, number, number]

    • Parameters

      • fx: number
      • fy: number
      • fz: number
      • ux: number
      • uy: number
      • uz: number

      Returns void