contactCallback with any body

Lax

23-05-2009 10:02:21

Hallo all,

I have the following problem:

When an enemy shoots an bullet and the bullet hits any body, then I need to play a sound and the bullet shall disappear. I have several types of Bodies like houses, trees, cases etc.
The long-winded way would be: set material pairs with bullet and houses, bullet and trees, bullet and cases. Then create the contactcallback(including userbegin, process etc) for each pair.
Now my question is: Is there a way to call one contactcallback, regardless of which body is collided with the bullet, so that I can play the sound and let the bullet dissapear.

thanks in advance.

Zero23

23-05-2009 12:13:18

Then use for all your bodys the same function for callback.

Lax

23-05-2009 14:29:27

Hm, is there not an faster way? I have ca. 20 different body types and this means, that I have to spezify 20 material pairs; bullet with houses, bullet with trees and call the same contact callback function. But if there is no other possibility, then I'll do it that way.

thanks.

Virginie

25-05-2009 08:40:40

Maybe you can use a switch in your type of body and use the sound as you want for each body...

oddrose

05-06-2009 12:29:39

yeah, basically you could assign the same material to all of those if you wanted to and the same material pair,...then you could just check which bodies collided in the callback