Sometimes in your games, you may need two bodies to overlap just like there wasn't any collision, while detecting the collision. This can be achieved using a sensor: a fixture that detects contacts without producing responses.
You can use sensors to create bodies so that you'll know when they collide without any physical contact between them. Just think about a character controlled by the player and a switch: you want to know when the player hits the switch to trigger some event, but at the same time you don't want the switch to react to player collision.
In this last script we'll test a sensor.
First, add the
Contacts
class to the package. This is not required to create a sensor, it's just to make you see how Box2D handles sensor collision.import flash.display.Sprite; import flash.events.MouseEvent; import Box2D.Dynamics.*; import Box2D.Collision.*; import Box2D.Collision.Shapes.*; import Box2D.Common.Math.*; import Box2D.Dynamics...