"nonmaterial" bodies

Hi,

I've just started playing with Box2D and I was wondering if there exists functionality for detecting collision between bodies without the physical response.

I'd like to create a zone where I can detect whether a body passes through (or touches) this zone, but I don't want the body to react to this zone. It should pass through it as if it wasn't there, but still show up in the contact list.

As an example; creating a body which (when going through the contact points) can apply a force of -2g to every body inside/touching it to make this zone anti-gravity-like.
For now you can use b2World::Query before each time step. This will let you find shapes that roughly overlap a specified axis-aligned box. Do you need a more detailed query?
(that was quick)

No, I don't really need a more detailed query - even though a polygon matching would have been better.

One of the reasons it came up was because of ... well, state changes based on position, and not neccessarily based on hitting a concrete other object.
Yeah, what you want is a typical operation in a game. I was curious if you needed contact information, like the normal vector and the penetration depth, of if you just needed the overlap status. The latter can be had much cheaper than the former.

I'll add shape "sensors" to the TODO list.
Neat 🙂

Well, I haven't thought too much about the concrete usage - overlap status should be more than enough, really.

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