Sound cones project backwards?
by Adam Beer · in Torque Game Engine Advanced · 04/08/2009 (9:10 pm) · 6 replies
I am making a flight sim, and I am trying to get the sound cones to project the sound to the rear of the airplanes. Here is my description datablock:
I have tried to put in negative values for the cones, but that didnt work. It seems that the cone points towards the object's bounds box pivot, and rotating that doesnt help as the shape moves backwards.
Here is a diagram of the situation:

Anyone have any idea how I can get the sounds to be projected backwards when using sound cones?
datablock SFXDescription(AudioJet3d)
{
volume = 1.0;
isLooping= true;
is3D = true;
ReferenceDistance= 20.0;
MaxDistance= 1000;
ConeInsideAngle = 90;
ConeOutsideAngle = 150;
ConeOutsideVolume = 0.1;
channel = $SimAudioType;
};I have tried to put in negative values for the cones, but that didnt work. It seems that the cone points towards the object's bounds box pivot, and rotating that doesnt help as the shape moves backwards.
Here is a diagram of the situation:

Anyone have any idea how I can get the sounds to be projected backwards when using sound cones?
#2
04/13/2009 (8:38 pm)
Thanks Tom. I have found where I need to set the transform. Currently the sound is being set to the renderTransform. How would you rotate the z axis for position of the getRenderTransform() function?
#3
04/13/2009 (8:52 pm)
Off the top of my head... MatrixF soundXfm = getRenderTransform() * MatrixF( EulerF( 0, 0, mDegToRad( 180 ) ) );
#4
04/13/2009 (9:04 pm)
I get the following errors:1>aircraft.cpp 1>..\..\..\..\..\engine\source\T3D\aircraft.cpp(822) : error C2668: 'mDegToRad' : ambiguous call to overloaded function 1> d:\IgnitionGames\Mach 1\Engine\engine\source\math/mMathFn.h(366): could be 'F64 mDegToRad(F64)' 1> d:\IgnitionGames\Mach 1\Engine\engine\source\math/mMathFn.h(356): or 'F32 mDegToRad(F32)' 1> while trying to match the argument list '(int)' 1>..\..\..\..\..\engine\source\T3D\aircraft.cpp(822) : error C2512: 'MatrixF::MatrixF' : no appropriate default constructor available
#5
04/14/2009 (11:34 pm)
Make 180 to be float: 180.fMatrixF soundXfm = getRenderTransform() * MatrixF( EulerF( 0, 0, mDegToRad( 180.f ) ) );
#6
04/14/2009 (11:44 pm)
Thanks Tom and Bank. Everything works great now.
Associate Tom Spilman
So depending on where your using this sound from it may be simple or a tad more difficult to fix.
If your creating and managing the sound source yourself then its simple as one of the parameters to all the create functions in script and in C++ is a transform for positioning the sound.
If your working with once of the vehicle classes you'll need to change the C++ code to change the orientation of the sound.
A better fix maybe be to provide an additional transform in either the vehicle datablocks or in the SFXProfile which is applied along with the sound source transform.