How to trigger collision sounds?

ola
Posts: 169
Joined: Sun Jan 14, 2007 7:56 pm
Location: Norway

How to trigger collision sounds?

Post by ola »

Hi again,

I'm now implementing sound into a game. I'd like to trigger some collision sounds whenever objects collide, and maybe make the kind of sound dependent on object type and how hard they hit each other. What's the recommended way to do this with Bullet?

Sorry if this has been discussed before, I wasn't able to find anything.

Best regards,
Ola
ola
Posts: 169
Joined: Sun Jan 14, 2007 7:56 pm
Location: Norway

Re: How to trigger collision sounds?

Post by ola »

sorry to ask again, but I haven't been able to come up with a good solution to this myself.

Looking for a good way to trigger sounds when objects collide. The audio side of things is working fine (I'm using OpenAL), it's just how to detect it with Bullet that puzzles me.

Maybe there is some kind of callback function I can register?
Or should I iterate through the contact manifold each frame and sort out which is what?
Or maybe do something in the constraint solver?

I'd also like to vary the sound depending on if a rigid body is hitting somthing (and how hard), if it's rolling against something or if it's sliding...

thank you,
Ola
ola
Posts: 169
Joined: Sun Jan 14, 2007 7:56 pm
Location: Norway

Re: How to trigger collision sounds?

Post by ola »

Oh nevermind. I just found this posting and there it is, got a rough version working now. :-)

http://www.bulletphysics.com/Bullet/php ... f=9&t=1943

Cheers,
Ola