[resolved] isSensor overrides isBullet's CCD ability

Hello everyone,

I am building a shooter game and I need to create dynamic bodies (bullets) that collide with other dynamic bodies (players) without making them react to the force (without pushing the players away).

the sensor attribute allows the body to AVOID affecting other bodies, triggering only the contactlistener. That's just what I need.
the bullet attribute allows CCD so there's no tunneling, making sure players get damaged. That's perfect.

Problem is: the sensor attribute seems to completely OVERRIDE the CCD ability of bullet-bodies and makes the bodies tunnel, thus allowing bullets to just go through other players and avoid damage. It happens between dynamic and static bodies alike.
I've tried to play with all kinds of values, but there's just no way to see it working on my side. Using Box2D 2.1A for Flash10.

Please help!
Hello again,

I just realized that setting a fixture to sensor disables CCD automatically. Problem still remains, I need to have CCD but without collision consequences.... or able to remove the bullet body before it affects the destination dynamic body... researching some more now 🙂
OK, I seem to have resolved it. I just overrode PreSolve in the contact listener. If the bullet touches the player, i disable the contact with contact.SetEnabled(false). That way begincontact and endcontact do not trigger and I can run my functions from within PreSolve instead.

Oh well... thanks forum for being there!! 😉
I'm having this same issue, and this solution looks like it will work for me - however I'm not clear on exactly how to implement, as I'm pretty new to Box2D. Can someone explain this solution in more detail?

In my case I want lines that never interact physically with any dynamic bodies, but sense when the fast-moving player crosses them.

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