Game Development Community

Mounting a sound emitter to an object?

by Richard Dechow · in Technical Issues · 05/21/2008 (9:13 am) · 2 replies

I've been searching the forums/docs for a few days now, and have yet to find an answer.

Anyway, What I'd like to do, is Mount a sound Emitter to an AI player, There is a 10 second looped sound, that I'm playing at the AI himself, and I want it to get loader as he gets closer to the player.

The closest I've been able to find is "play3d" but you can only specify the transform that the sound will play at, it wont move from that spot once it starts playing. I want the sound to move with the object, is there any way to "mount" the sound/ sound emitter to a moving object so you can hear it getting closer and further?

#1
05/21/2008 (1:05 pm)
You'd need to edit the engine itself. It's entirely possible with OpenAL to set a position for the audio. As the object moves, so would the sound emitter. In OpenAL you can set a 3D coordinate which, for TGB, isn't all that complicated. The z co-ordinate could always be zero and X and Y you'd base on the position of the object in the scene graph.
#2
05/21/2008 (4:18 pm)
Check out Todd's environment pack - he attached emitters to his watermill or so I believe.

http://garagegames.com/products/104/

It might give you some inspiration as to how to tackle it.