atmoky Engage Server SDK is now available! Check out the documentation to learn more.
API Reference
Classes
AudioListener

AudioListener

Summary
The 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.

Methods

getPosition

Returns the position of the audio listener.
Signature
getPosition()
Returns
Vector3D the position of the audio listener

getRotationQuaternion

Returns the rotation of the audio listener using quaternions.
Signature
getRotationQuaternion()
Returns
Quaternion

setOrientation

Sets the orientation of the listener using two vectors.
Signature
setOrientation(forward: Vector3D, upward: Vector3D)
NameTypeDescription
forwardVector3Dunit-vector pointing to the listener's forward direction
upwardVector3Dunit-vector pointing to the listener's upward direction
Returns
void
Remarks
The 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.

setPosition

Sets the position of the audio listener.
Signature
setPosition(x: number, y: number, z: number)
NameTypeDescription
xnumberx-coordinate
ynumbery-coordinate
znumberz-coordinate
Returns
void

setRotation

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.
Signature
setRotation(yawInRadians: number, pitchInRadians: number, rollInRadians: number)
NameTypeDescription
yawInRadiansnumberrotation around the up-down axis in radians
pitchInRadiansnumberrotation around the left-right in radians
rollInRadiansnumberrotation around the front-back in radians
Returns
void
💡
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).

setRotationQuaternion

Sets the rotation of the audio listener using quaternions.
Signature
setRotationQuaternion(w: number, x: number, y: number, z: number)
NameTypeDescription
wnumberw-component
xnumberx-component
ynumbery-component
znumberz-component
Returns
void

atmoky Logo

© 2024 atmoky, GmbH.
All rights reserved.

We use cookies to measure and improve your browsing experience, and serve personalized ads or content.