Collision callbacks between bullets and walls: how do they w

Hello,

I'm working on a top-down shooter.

Where:
-Bullets are Kinematic bodies.
-Players are Dynamic bodies.
-Walls are Static bodies.

I'm able to detect collisions between the bullet and other players just fine. The collisions are detected by setting a ContactListener on the world that gets the Fixture user data and makes a callback to the Players so they can play a .wav file that says "Ouch! Ye Hit me". However, I was scratching my head for a long time when I couldn't get it to work with walls. I re-read the manual and found that collisions between static and dynamic bodies won't work. Bummer.

In summary, how would you handle or work around this situation:
I have a wall backed by a Static body.
I have a bullet backed by a Kinematic body.
I only need to know the moment of impact and the fixtures (or bodies) involved.
I don't need (nor want) Box2D to handle anything in terms of collision resolution between the two objects.

Also, I'd really like to be able to keep the body types as they are if possible, since it makes sense as it is. If only I could be notified of their collisions some how.

Thanke.
Why do you need the bullet to be kinematic? Kinematic bodies are used when you continually alter their velocity or transform directly. If the bullet is only fired by setting the velocity once, it doesn't matter that it's a dynamic body.
To make a dynamic body have continuous collision detection, set it's b2BodyDef::bullet = true, so that high velocity bullets don't tunnel.

You can make the bullet a sensor if you don't want any collision handling and only the detection.
Hi and thanks for the speedy reply!

The World has a gravity of (0, -10), that causes all Dynamic bodies to fall.

If I use a Kinematic body with a starting velocity, I can set it and forget it.

If I use a Dynamic body I believe I need to set the linear velocity in every update (which might still drop a little due to gravity).

Original thread: https://box2d.org/forum/viewtopic.php?t=6690