Filtering collisions between two types of bodies?

Hi,

I'd like to do a bit of filtering for a collision. I have a "rock" and a "horse". When the two collide, I'd like the rock to remain stationary as if nothing hit it, but the horse should react as usual, bouncing off of it.

I have a third type of body, a hammer. If the hammer hits a rock type, in this case I'd like the rock bodies to react as usual.

Is this possible? I imagined that in my preSolve handler, I could check the types of the bodies that are colliding. If one is a rock, and one is a horse, I could somehow nullify the force which is supposed to be applied to the rock.

Thanks
You could have a kinematic body which 'shadows' the rock body, with the same fixture. Every frame, set the position + angle + linear and angular velocities of the shadowing body to the same as the dynamic body. Set the collision filter of the fixture on the kinematic body to only collide with the horse.

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