Edge Collision Detection

Hi,
After experimenting with Box2d for quite a while now , i came across a hurdle
well a similar question's been asked many a times but i found no subtle approach. It'd be great if someone could help me with this.

i created a body with b2polygondef , shape definition etc.(setasbox actually) and i could setuserdata to the body , the thing is how do you detect what edge of the box now created is hit by another body.

the way i do this, is by creating another two bodies as sensors around the main body and detecting collision on them.
maybe this will help you

http://www.emanueleferonato.com/2011/03 ... oy-step-2/
Thanks matuzo,
The link you referred to deals with collision with the boxes as a whole i believe , I think i found a way though , here's how i did it i used "world.query" to determine the bodies in given area , the b2AABB here is the edge of the body that is hit. Difficult to comprehend with multiple bodies i know but the actor can be easily modified to include the code. If someone's interested ill post the code.
thanks again for replying 🙂
@amanpreet

Actually, I am interested, I am having a similar problem. Could you send it to me in whatever way?
Here you go
-----------------------------------------------------------------------------------
var Hit = GetBodyAtPoint(child.x, child.y+(child.height/2+2), true);
if (Hit != null && Hit.m_userData != child)
{
Body.ApplyImpulse(new b2Vec2(0.0, -3.0), Body.GetWorldCenter());
}

public function GetBodyAtPoint(px:Number, py:Number, includeStatic:Boolean = false)
{
// Make a small box.
var px2 = px/physScale;
var py2 = py/physScale;
var PointVec:b2Vec2 = new b2Vec2();
PointVec.Set(px2, py2);
var aabb:b2AABB = new b2AABB();
aabb.lowerBound.Set(px2 - 0.001, py2 - 0.001);
aabb.upperBound.Set(px2 + 0.001, py2 + 0.001);

// Query the world for overlapping shapes.
var k_maxCount:int = 10;
var shapes:Array = new Array();
var count:int = m_world.Query(aabb, shapes, k_maxCount);
var body:b2Body = null;
for (var i:int = 0; i < count; ++i) {
if (shapes[i].m_body.IsStatic() == false || includeStatic) {
var tShape:b2Shape = shapes[i] as b2Shape;
var inside:Boolean = tShape.TestPoint(tShape.m_body.GetXForm(), PointVec);
if (inside) {
body = tShape.m_body;
break;
}
}
}
return body;
}

---------------------------------------------------------------------
you could see it in action here :

http://www.emanueleferonato.com/2008/10 ... ing-box2d/

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