SummaryThe virtual AudioListener. Use this class to set listener properties like position or orientation/rotation.
This class is not meant to be instantiated directly, the AudioListener is part of the Space class.
Returns the position of the audio listener.
Vector3Dthe position of the audio listener
Returns the rotation of the audio listener using quaternions.
Sets the orientation of the listener using two vectors.
setOrientation(forward: Vector3D, upward: Vector3D)
|unit-vector pointing to the listener's forward direction|
|unit-vector pointing to the listener's upward direction|
RemarksThe two vectors needed to set the listener's orientation are the forward and upward facing vectors relativ to the listener's view. The forward vector would be the vector the listener's nose points to, the upward pointing towards the top of the listener's head.
Both vectors have to be perpendicular to each other and have to be of length 1.
You can call Vector3D.normalize() to normalize the vectors to unit length.
Sets the position of the audio listener.
setPosition(x: number, y: number, z: number)
Sets the listener's rotation using Tait-Bryan Yaw, Pitch, and Roll angles.
The rotation sequence is yaw->pitch->roll with intrinsic rotations. That's first a rotation around the up-down axis, followed by a rotation around the resulting new left-right axis, and finally a rotation around the resulting front-back axis.
From an extrinsic view (rotations around the global axes) the sequence would be reversed.
setRotation(yawInRadians: number, pitchInRadians: number, rollInRadians: number)
|rotation around the up-down axis in radians|
|rotation around the left-right in radians|
|rotation around the front-back in radians|
In right-handed coordinate systems (atmoky, openGL, three) the yaw and roll angles are positive when rotating left and rolling to the right, respectively. In left-handed coordinate systems (unity) the sign is flipped (positive when rotating right, rolling to the left).
Sets the rotation of the audio listener using quaternions.
setRotationQuaternion(w: number, x: number, y: number, z: number)