Box2d is sensor behavior

Hello everybody!

Please help me to understand how to use isSensor feature of the box2d shapes.

from the presentation for node10 box2d workshop"i’ve learned that

  1. Shapes which are sensors will intersect with others instead of colliding, bouncing etc, but information about their interactions can be retrieved through getContactDetails node.
  2. You can manage which shapes interact with other like physical bodies or not with group indices.

I cannot get this to work. When switching on isSensor pin, my shapes dont fell anything regardless of group indices, and no any data appears in getContactDetails.

happy if anybody could explain this **))

thx

Hey,

Did you check out the ‘box2D playground’ in the contributions?

box2d-playground

This probably does everything you ever wanna know about Box2d … all in one very pretty patch.

  • I’m guessing the IsSensor pin is not really what you’re looking for. You could try to explain a little more what you actually want to achieve in your own patch. Somebody will probably tuck a little demo patch together for you. ;)

found this on my HD. maybe it helps.

Box2dplusMouse.v4p (34.9 kB)

Hi zepi, thx for your reply,
but i still cant get the behavior i need.

i just want some circles move overlapping some lines (or quads) without any physical simulation, but i need to know when specific circle intresects with any line (or quad).

i cant get it with raycast nor with aabb query, cause aabb works only for two quads and rays dont fit also.

suppose sensor flag should do exactly what i need but it doesnt work, maybe its a bug.

as to groups that are collliding or not, here all right, no problems

probably this task is better to be done without box2d, now i’ll try to get it with hittest plugin

Ah, seems since latest version Sensor in contact is indeed broken.

Issue is now contacts are retrieved via ContactResult (to retrieve normals/impulse) instead of ContactAdd, but Sensors of course don’t produce a result…

Added GetContactReport node, which includes sensors, needs a bit more testing (for filtering), but seems to do what’s expected.