Previous Topic Index Next Topic
[API function]

FSOUND_3D_Listener_GetAttributes

This retrieves the position, velocity and orientation of a 3d sound listener.

void F_API FSOUND_3D_Listener_GetAttributes(
F_FLOAT_API *pos,
F_FLOAT_API *vel,
F_FLOAT_API *fx,
F_FLOAT_API *fy,
F_FLOAT_API *fz,
F_FLOAT_API *tx,
F_FLOAT_API *ty,
F_FLOAT_API *tz
);

Parameters

pos Pointer to a position vector (xyz float triplet), of the listener in world space,
measured in distance units.
This can be NULL to ignore it.
vel Pointer to a velocity vector (xyz float triplet), of the listener measured in
distance units PER SECOND.
This can be NULL to ignore it.
fx pointer to x component of a FORWARD unit length orientation vector
This can be NULL to ignore it.
fy pointer to y component of a FORWARD unit length orientation vector
This can be NULL to ignore it.
fz pointer to z component of a FORWARD unit length orientation vector
This can be NULL to ignore it.
tx pointer to x component of a TOP or upwards facing unit length orientation vector
This can be NULL to ignore it.
ty pointer to y component of a TOP or upwards facing unit length orientation vector
This can be NULL to ignore it.
tz pointer to z component of a TOP or upwards facing unit length orientation vector
This can be NULL to ignore it.

Return Value

On success, TRUE is returned.
On failure, FALSE is returned.

Remarks

FSOUND treats +X as right, +Y as up, and +Z as forwards. (left handed)
To map to your own coordinate system, flip and exchange these values. For example if you wanted to use right handed coordinates, you would negate the Z value of your own direction vector.
Orientation vectors are expected to be of UNIT length. This means the magnitude of the vector should be 1.0f.
---------
A 'distance unit' is specified by FSOUND_3D_SetDistanceFactor. By default this is set to meters which is a distance scale of 1.0.
See FSOUND_3D_SetDistanceFactor for more on this.
---------
Please remember to use units PER SECOND, NOT PER FRAME as this is a common mistake.
Do not just use (pos - lastpos) from the last frame's data for velocity, as this is not correct.
You need to time compensate it so it is given in units per SECOND.
You could alter your pos - lastpos calculation to something like this.
vel = (pos-lastpos) / (time taken since last frame in seconds).
I.e. at 60fps the formula would look like this
vel = (pos-lastpos) / 0.0166667.
___________________
Supported on the following platforms : Win32, WinCE, Linux, Macintosh, XBox, PlayStation 2, GameCube

See Also

FSOUND_3D_Listener_SetCurrent , FSOUND_3D_SetAttributes , FSOUND_3D_SetDistanceFactor , FSOUND_3D_SetDopplerFactor

This document copyright ©Firelight Technologies, Pty, Ltd, 1999-2002. All rights reserved.
Generated Thu Dec 15 17:31:27 2005 by SourceDoc v0.10, the automated source code documenter.